how do i increase the force of my bullet prefab?
I made a cube and when i shoot at it with my gun and bullet prefab
it moves only once when i hit it. What is the best way to fix this?
thanks
wayne
how do i increase the force of my bullet prefab?
I made a cube and when i shoot at it with my gun and bullet prefab
it moves only once when i hit it. What is the best way to fix this?
thanks
wayne
something like
bullet.rigidbody.AddForce(transform.forward * 1000);
this will go ‘forward’ in the z axis, and lower the drag to 0 if u dont want the bullet to slow down.
If u use Vector3 like he said, use a much lower value because the the bullet will fly in meters per seconds if im right.
The impact depends on the bullet speed and the masses of the bullet and the target. You can reduce the target mass to get a bigger impact. You could also increase the bullet mass or speed - but if you are firing your projectile with AddForce, a mass increase will reduce the end speed, so you may not notice any difference at all. To avoid this, increase the force too or replace rigidbody.AddForce(force) by rigidbody.velocity = speed where speed is a Vector3 like force, but usually with much lower magnitude (5 to 20).
Yes, the speed is in meters per second. When you add force like above, you're actually applying a force of 1000N to the mass during the physics cycle (20mS). Supposing the mass is 1 (default value), the acceleration during this time will be 1000m/s<sup>2</sup>, which in 20mS will result in 20 m/s. If you double the mass, the acceleration will be 500m/s<sup>2</sup>, reducing the speed to 10 m/s.
– aldonaletto