i made a script for player movement and my player is moving without any input, is it because its a capsule?
but at the start when i made the cript it worked fine
Could be:
- Your code is making it move
- Gravity is making it move
- Some other script is making it move
- Collisions with some other object are causing physics forces to make it move
The last one was it. I removed some walls and now everything is working corectly. Thank you
Is there any way that I can prevent collisions with some other objects to force my player to move? I want them to interact to each other but I don’t want my player’s velocity to be affected from collision.
You can use trigger colliders. Set the “isTrigger” to true on the collider. Then you can use OnTriggerEnter/Exit to make them interact in script but they won’t physically push each other.
I don’t want the collider to move through another collider. Just wondering whether there is a way to prevent getting some velocity and having two colliders colliding at the same time. For now I’m doing it by assigning Vector2.zero in every FixedUpdate. I just thought there should be a way to close adding force on the UnityEditor
Enable “kinematic” on the one that you don’t want to move.
Then I have to do my own gravity system right? Thanks for the reply btw
Yes, if you make the object kinematic you will have to manually move it. A kinematic Rigidbody cannot be affected by any forces, torques, collisions, or joints. It can only be moved by your scripts.
You can also leave the body as non-kinematic but limit movement or rotation on any x/y/z axis using constraints on the Rigibody