Collision/physics bug


i have been trying to fix the same issue i have been having in my game for some time now. but i cant find a solution. everytime the game start collision is active. but when i start controling the player the player stop falling and is able to walk true walls.

Hello, and welcome to PlayCanvas!

The link you provided is a published build. We have no way of seeing how you implemented it and as such have no means to offer an advice. Instead, you probably want to give your project link, so we can check the Edtior.

1 Like

Hi @helpreallyneeded and welcome,

Your scene setup is correct, the issue is in your movement.js script. You are using pc.Entity translate() to move your player, that breaks all physics/collision calculations.

A dynamic body should be moved in one of the following ways:

  1. By applying forces/impulses
  2. By setting the linear/angular velocity directly
  3. Using pc.Rigidbody.teleport()

Check the following tutorial on how it moves the player entity as an example:

thanks for the help i reallly appreciate :+1:

1 Like

iā€™m still having some problems trying to implement the code im new to coding and most stuff online is a bit confusing

Try putting much larger values here to start with:

    if( {
        this.entity.rigidbody.applyForce(10000, 0, 0);

I suggest using forces or impulses to move the player. Use teleport to change the rotation or teleport the player. And linear and angular velocities should be used as checking reference to see how fast the player is going for stuff like if statements.