New answers tagged

0

It's possible the player object moves into a wall and the position is updated, then collision is detected and the players position is then corrected creating a "bouncing" effect. To correct this, compute your collisions prior to moving the player (or probably any object).


0

Make a script that will check for the magnitude of the rigidbodies like so if(GetComponent<RigidBody>().velocity.magnitude > MAX_SPEED){ TURN GRAVITY OFF. } This will make sure that your rigidbodies can't have a speed higher than your preset value.


0

It is due to constantly applying AddForce in FixedUpdate. You can easily do it by assigning zero to speed and set velocity to zero. rb.AddForce(movement*speed); if (Input.GetKeyDown(KeyCode.Space)) { speed = 0; rb.AddForce(-rb.velocity); rb.velocity = Vector3.zero; rb.position = new ...


2

If you want to stop a physics object from moving, you need to zero the forces and the velocity of the RigidBody. rb.velocity = new Vector3(0,0,0); For zeroing the force, you can apply a force opposite to the forces you've added that frame already. However, I'd suggest simply not adding those forces if you're stopping. It means a slight rearrangement of ...


1

Ok, what you need is a quaternion. The rotation variable that you mentioned. So to correctly create a quaternion in the direction you want you need to create it using the eular method.So to create your object: Instantiate(Resources.Load("P1Bullet"), transform.position, Quaternion.Euler(-90f, 0f, 0f)); As I don't know the direction you want to face and ...



Top 50 recent answers are included