playMaker

Author Topic: Getting surface angle  (Read 401 times)

IIKII

  • Full Member
  • ***
  • Posts: 114
  • Lonely developer
    • View Profile
    • Patreon
Getting surface angle
« on: September 17, 2019, 05:31:46 AM »
Hi, i am trying to get a angle between a floor and the player to see if the player is on a slope. So if the angle is bigger than 30, the animation and speed will change.

How do i achieve that?
Support me on Patreon for free adventure games and development insights - https://www.patreon.com/koexstudio

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 5795
    • View Profile
    • jinxtergames
Re: Getting surface angle
« Reply #1 on: September 17, 2019, 07:57:42 AM »
Hi.
I looked on unity forums and found this :

https://answers.unity.com/questions/50774/checking-slope-angle-the-object-is-standing-on.html

So i made a action (attachment below) based on this answer, but i did not test it tho.
Let me know if it works.

To use you need to get the contact normal (with Get Colission Info action)
and use in the action.
also select the up direction from the normal.


IIKII

  • Full Member
  • ***
  • Posts: 114
  • Lonely developer
    • View Profile
    • Patreon
Re: Getting surface angle
« Reply #2 on: September 17, 2019, 11:22:04 PM »
Yeah i think it works but i am using raycast.

Thanks for the action :)

Support me on Patreon for free adventure games and development insights - https://www.patreon.com/koexstudio