Search Unity

Colliders and physics body

Discussion in 'Physics for ECS' started by shotoutgames, Jul 2, 2020.

  1. shotoutgames

    shotoutgames

    Joined:
    Dec 29, 2013
    Posts:
    290
    Player collides with a cube and cube moves from collision but I want the cube to stay still.
    I set to static or kinematic and player just goes straight through the cube???

    Any ideas?

    Thanks
     
  2. ScriptsEngineer

    ScriptsEngineer

    Joined:
    Jun 8, 2018
    Posts:
    37
    Add static to cube and dynamic for player, if no work the problem is another param.
     
  3. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    What exactly is your player? A Character Controller from the physics package? Or just a body you are driving around?
     
    shotoutgames likes this.
  4. shotoutgames

    shotoutgames

    Joined:
    Dec 29, 2013
    Posts:
    290
    Custom player with skinned mesh so using convert to object on parent that contains the physics body and shape.
     
  5. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    And how are you moving this player? By setting velocities, or positions? Also, what's the player's motion type?
     
  6. shotoutgames

    shotoutgames

    Joined:
    Dec 29, 2013
    Posts:
    290
    The linear velocity changes but doesn't update the translation in the entity debugger accordingly


    Code (CSharp):
    1.   protected override void OnUpdate()
    2.     {
    3.         /// Get the physics world.
    4.  
    5.         Entities.WithoutBurst().ForEach(
    6.             (
    7.                 Entity entity,
    8.                 ref LocalToWorld localToWorld,
    9.                 ref Translation translation,
    10.                 ref Rotation rotation,
    11.                 ref PhysicsVelocity physicsVelocity,
    12.                 in PhysicsMass physicsMass,
    13.                 in ApplyImpulseComponent applyImpulseData
    14.             ) =>
    15.             {
    16.                 physicsVelocity.Linear = applyImpulseData.Velocity;
    17.             }).Run();
    18.     }
     
  7. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    And physics is stepped? Can you see the integrate jobs?