- Home /
Push Objects.
I have a character controller on my player.
The block has a rigid body with rotations fixed and with gravity set.
When im close to the object and I press "push key" I want to make the pushing forward posible. However i can only do it if i disable gravity,set isKinematic, and set the block collider to trigger and attach it to the player. The problem with this solution is that the block can be pushed through walls, and then is not really usefull anymore.
Is there another way to do this?
Thanks in advance
You can add force in the desired direction to move the object and keep is$$anonymous$$inematic off and gravity on
Also, if you don't want gravity on and you want is$$anonymous$$inematic, you can use the vector.lerp function. I use this with an invisible grid to deter$$anonymous$$e exactly where my object is and stop it if I stop pressing the button or if it equals the outer column (x position in my 2d game) or row (y position) of the grid.