playMaker

Author Topic: Set Player Object Angle to match slope  (Read 1065 times)

SlimeyOoze

  • Playmaker Newbie
  • *
  • Posts: 8
Set Player Object Angle to match slope
« on: February 17, 2022, 01:57:12 PM »
Hello All,

I purchased PlayMaker 2 days ago and I'm enjoying it so far.

I recently setup the new control input system to control a player object within a basic environment for testing. The environment contains a flat plane and another acting as a slope. The player basically moves around a flat plane fine but on assending the slope the player objects angle doesn't match the angle of the slope, it basically moves up the slope still at the "flat plane" angle.

How do I go about applying actions/events in order to correct this? Where do I start?

Thank you

SlimeyOoze

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Set Player Object Angle to match slope
« Reply #1 on: February 17, 2022, 02:43:18 PM »
Experimenting and watching the "Raycast" tutorial on YouTube I think I'm getting there.

I now have my object setting to the correct angle as it hits the slope.

This was achieved by storing a Raycast *Hit Point result in a Vector 3 variable and giving the slope a trigger tag. On impact, the event transition then runs a Look At Direction action using the stored variable as the Target Direction and the Object Vector 3 from the controller as the Up Direction.

I guess I just need to do this in reverse on the way down?

If there are any better solutions I'm open for suggestions

Thanks


***Correction, Not Hit Normal (this caused object to rotate wrongly), Hit Point seems to work better but will continue testing!
« Last Edit: February 17, 2022, 05:38:08 PM by SlimeyOoze »

Bender

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Set Player Object Angle to match slope
« Reply #2 on: March 09, 2023, 04:05:51 PM »
Have you solved this problem? I've been trying for three months now. No one wants to explain how to tilt the player according to the angle of the surface.