- Home /
Move a rigidbody when Kinematic ??
I know this is pretty much very basic question and has been asked a lot of times.
I have a rigidBody which is acting weird when is moved by rigidBody.velocity
how can move this object when it is set to kinematic
Here is the information i have to move this body
float h = CrossPlatformInputManager.GetAxis ("Horizontal");
float v = CrossPlatformInputManager.GetAxis ("Vertical");
Vector3 direction = new Vector3 (h, v, 0.0f);
when it wasnt kinematic i was using this which was acting weird
rigidbody.velocity = direction * speed;
but this doesnt support kinematic bodies
Moveposition is also not working because it is limited to the values of h and v as long as i reach the limits of Joystick the body stops moving
Answer by martin101 · Jan 01, 2015 at 11:23 AM
well I am still using rigidbody.velocity with my rigidbody being non kinematic and solved the weird behaviour/movement of rigidbody by writing
rigidbody.velocity = Vector3.zero;
rigidbody.angularVelocity = Vector3.zero;
at the top of my Update method, with this i am applying vector3.zero to every frame thus by preventing unnecessary movement
Answer by asafsitner · Jan 01, 2015 at 11:07 AM
When the rigidbody is marked as Kinematic, it means it's supposed to be moved outside of the physics system.
Move it like any other non-physics Transform, in the Update method using Transform.Translate
or Transform.position
.
i am trying to avoid transform.translate because of its teleport and bad collision detection qualities ( may be im wrong here ). and rigidbody.position isnt working and is having the same problem as $$anonymous$$oveposition i.e. its limited to the boundaries of my Joystick
Answer by ozcomingfroo_unity · Oct 26, 2019 at 09:02 AM
I have Unity version 2018.3.13 and this allows me to move a Kinematic object with the velocity.
That being said, it was done in a 2D environment, so maybe 3D objects cannot have that
Edit: I am sorry , setting velocity for a Kinematic only works for 2D objects. I just tested with a 3D object and the result was as you expect. My fault
Your answer
Follow this Question
Related Questions
Kinematic RigidBody does not collide with Wall using MovePosition 2 Answers
Kinematic how to know rigidbody velocity vector? 1 Answer
Set velocity of kinematic rigidbody appropriately 1 Answer
Rigidbody.MovePosition was working perfectly, now completely frozen 0 Answers
Transferring velocity from kinematic to a rigid body 0 Answers