Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Yoshinori_Date on December 02, 2019, 03:09:16 PM

Title: Problems with getting angle of the slope dynamically and correctly [SOLVED]
Post by: Yoshinori_Date on December 02, 2019, 03:09:16 PM
I made a system that changes the character animations depending on the angle of the slope, i use 4 raycasts forward, backward, left and right to get the angle using "get angle3 XYZ" and z as float to control the animations, but when i walk from a back side of the mesh or the rotated version of platform then z value is inverted and animations is wrong, i think the pics explained it better, first is how it should be
(https://sun9-53.userapi.com/c857224/v857224957/73a65/J2EWHRw0PvE.jpg)
and second is the problem
(https://sun9-47.userapi.com/c857224/v857224957/73a52/_buP28_pB2M.jpg)
mb this whole system is just a mess?
Title: Re: Problems with getting angle of the slope dynamically and correctly
Post by: jeanfabre on December 03, 2019, 03:37:07 AM
Hi,

I would separate the problem in two.

 can you position dummy cubes under the feet of the character on the slope, do that with first some simple dummies, then plug the character feet. make sure the cubes are position and rotated properly to match the slope.

 once you have that, I am not even sure how you can force an animation to adjust its feet placement to match the dummies you have now in place.

let me know when you get the first step, this should require only one raycast per feet, straight down and the first hit is your slope, get the hit normal and position and match the cube transform to that.

 
Bye,

 Jean
Title: Re: Problems with getting angle of the slope dynamically and correctly
Post by: Yoshinori_Date on December 03, 2019, 06:03:52 AM
i don't quite get how to do this exactly, and i think it's not exactly what i need, because i need different float values to play the walking up, down and horizontally on the slope animations, i try right now to cast 8 rays top down (2 in each direction) and get the distance between the 2 rays, but the distance is not that different between 45 degree slope and almost flat slope, i tried get the angle between 2 hitpoins, but it's also kinda weird
Title: Re: Problems with getting angle of the slope dynamically and correctly
Post by: Yoshinori_Date on December 03, 2019, 12:01:24 PM
ok, i did it, i use 16 objects, 8 down, and 8 a bit higher shooting rays down and when they hit ground i use get position of object under the ray and vector3 operator to get the distance between hit point and the object that is down, for now it works great, but i need keep in mind the distance between those objects
Title: Re: Problems with getting angle of the slope dynamically and correctly [SOLVED]
Post by: jeanfabre on December 03, 2019, 01:18:27 PM
Hi,

 Could you show us how it looks when it works? I am quite curious!

Bye,

 Jean
Title: Re: Problems with getting angle of the slope dynamically and correctly [SOLVED]
Post by: Yoshinori_Date on December 03, 2019, 02:17:11 PM

and here is the system
(https://sun9-15.userapi.com/c854320/v854320421/18d639/KjYrytG6isg.jpg)

and on the slope
(https://sun9-24.userapi.com/c854320/v854320421/18d643/VgMfLfC5IqU.jpg)
Title: Re: Problems with getting angle of the slope dynamically and correctly [SOLVED]
Post by: djaydino on December 03, 2019, 10:46:59 PM
Hi.
Wow Very Impressive!

I love the way the arms also move depending on the slope walking!
Title: Re: Problems with getting angle of the slope dynamically and correctly [SOLVED]
Post by: jeanfabre on December 04, 2019, 12:42:29 AM
Hi,

 Cool!, Do you have a twitter account so that I ref you, I'd like to tweet about this.

Bye,

 Jean
Title: Re: Problems with getting angle of the slope dynamically and correctly [SOLVED]
Post by: Yoshinori_Date on December 04, 2019, 02:53:47 AM
yeah https://twitter.com/Yoshinori_Kudo (https://twitter.com/Yoshinori_Kudo) and thank you both, it's very flatering