A Simpler Sample On How To Use The New Unity Physics

hey Everyone.
im trying to change my previous MovementSystem from Translating using the Translate ComponentData TO using the new Physics Body ComponentData and it’s PhysicsVelocity, But i didnt get how it really works + for an unknow reason my Player ( Kinemitic ) is able to collide only with Dynamic Bodies. (pass through Kinemitic and static bodies )
am i responsible for Collisions and Gravity ?

Scroll to the bottom of this page: Unity - Manual: Introduction to collision

here you will find the rules for collision. Kinematic cannot collide with kinematic.

So what kind of physics body should be used for a character? I tried the dynamic but I didn’t found how to freezeRotation on specific axes.
The kinematic is not able to collide with static colliders within the environment.
I’m lost !

It should be a collider with a rigidbody, which will collide with static colliders, other rigidbodies, and other kinematic rigidbodies.

Also, never set the position of a non-kinematic rigidbody, as this will not cause the system to perform collision checks. Instead, set the velocity on the rigidbody to achieve movement.

Sorry but i didnt got what type of rigidbody i have to use ?
ps: im talking about the new Unity Physics ( DOTS ) not the OOP version.

Have you seen the unity sample for a character controller using DOTS?

https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/UnityPhysicsExamples/Assets/Demos/6.%20Use%20Cases/CharacterController

i tried to replicate the logic but im not able to :frowning:
this is why im asking for a simpler Sample.

can you someone make a simpler example of how to move an Entity ( Capsule Physics body ) with float2 inputs and colliding with Walls ( Static bodies ) ?

You need to modify the velocity component(PhysicsVelocity), in the charactercontroller example the linear velocity is what’s being modified. Modifying the translation results in collisions being ignored by the collider that is being translated. Not sure if its by design but that was my experience.

Correct, this is by design! Setting the velocity impacts physics, setting position does not. If you think about it, this makes perfect sense. Objects in the real world don’t move by setting position. You apply forces to them and those forces change based on interactions with the environment. The exception is Kinematic bodies: you can think of these as objects with infinite momentum, as they can impact non-kinematic bodies but pass right through anything else.

Thank you guys,
as you can see in my first comment i said that im trying to change my previous MovementSystem from Translating using the Translate ComponentData TO using the new Physics Body ComponentData and it’s PhysicsVelocity,
im just looking for a simpler example moving a character and interacting with environement.

because even moving with velocity im still not colliding with Kinemitic and static bodies.

Try Dynamic.
You can set the inverse of the Inertia tensor to 0 and it will not rotate due to external constraints, collisions or forces.
You can also set the mass extremely high so that it will not be affected much by other dynamic objects but will still collide normally with Kinematic and static bodies.
Friction should probably be 0, depending on how you want it to react when it brushes against kinematic or static objects.