Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question Velocity damped each frame? Are enemies continuously colliding with the ground?

Discussion in 'Physics for ECS' started by frankfringe, Jan 24, 2024.

  1. frankfringe

    frankfringe

    Joined:
    Feb 9, 2019
    Posts:
    134
    Hello, I want to have my enemies in the game as dynamical bodies. Therefore, each step, I calculate their targetVelocity and currentVelocity and update the currentVelocity in the direction of the target.

    Even after deactivating all friction and VelocityDamping on the PhysicsBody, there is still some damping happening and I see that the velocity values decrease frame by frame.

    This seems to be happening because the Entities are continuously colliding with the ground, there is a collision event each frame.

    What are the ways to work around this problem? I could remove the Physics body on the ground and do gravity etc. manually, and let the rest still be handled by physics, but is there an easier way?
     

    Attached Files:

    Last edited: Jan 24, 2024