Is there a way where a Kinematic Rigidbody will not be able to pass through other Static rigid body?
I don’t want gravity to affect the player in the game as it is able to fly, but it keeps passing on through other collisions with static rigid body.
I am making a 2d game, and I don’t want the player (Kinematic) to be able to pass through the walls and the platforms which are static.
Kinematic objects work like that, so most likely you need to use a dynamic rigid body.
To cancel gravity you can override the player’s linear velocity and move him directly like that. So instead of using forces you can manipulate its velocity and cancel the effect of the gravity force.
Ohhh, thank you for your reply!
So I tried using dynamic rigid body. I just scratched off the idea of the player being able to fly haha!
So I used applyForces for right and left movement, and applyImpulse for the jump.
However, the whole game gets ruined when I try to move? I don’t know how to explain it but here is a short clip.
I am not sure what am I doing wrong.
And if I am to code using player’s linear velocity, how? I am very much new to all of this, a format or a guide would help! Thank you so much for your time!
Here is the link to the editor:PlayCanvas | HTML5 Game Engine
That’s great, and nice looking game!
So you can easily fix that by setting your angular factor to 0,0,0 in the rigid body settings:
That will stop your player body from rotating in any direction.
All this time, it’s just the Angular Factor?! Thank you so much! You saved my life!
Yeah, and actually if you don’t care about movement on a certain axis at all e.g. Y, then you can set Linear Factor on that axis to 0.0.
That way it won’t move at all on that dimension.
I see! Thank you so much for your help!