Hi!
I'm having a problem with ragdolls, for some reason
they only get force applied to them when I aim a little down and
their spawn position is doubling for some wired reason,
meanwhile its only a problem with the dolls, a normal object works
just fine..
Here is a video to illustrate: https://www.youtube.com/watch?v=b-_Kdm-Jhsk&feature=youtu.be
this is the code I used:
void Shoot()
{
if (Input.GetButtonDown("Fire1"))
{
GameObject bullet = Instantiate(bulletPrefab, shootPos.position, shootPos.rotation);
Debug.Log(shootPos.position);
Rigidbody2D rb = bullet.GetComponent();
rb.AddForce(shootPos.up * bulletForce, ForceMode2D.Impulse);
Debug.Log(shootPos.position);
Destroy(bullet, 5f);
}
}
Thanks in advance!
Daan
↧