playMaker

Author Topic: Restricting movement/axis from collision hit  (Read 1210 times)

autumnboy

  • Junior Playmaker
  • **
  • Posts: 77
Restricting movement/axis from collision hit
« on: December 19, 2021, 12:19:44 AM »
Hi,
I need some help figuring out logic.
So I'm wanting to stop movement on an axis when it hits a wall. I have a 3rd person player that gets input based on camera, so horizontal and vertical are based from that.

The restraint works when camera is same direction as player direction in world but when the camera's angle changes the required direction for the player to face forward it doesn't really work.

So for example if the collision hit is (0,0,1) but the player is pushing forward at (1,0,0) I can't accurately restrict the axis.

Is there a way I could figure out how to get the collision hit normal based off player's forward direction from camera or another way to go about this?

Thanks
 Josh

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Restricting movement/axis from collision hit
« Reply #1 on: December 19, 2021, 10:28:11 AM »
Hi.
Maybe with some raycasts/boxcast depending on the direction the player is moving.