Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Matthew on February 27, 2014, 08:23:23 PM
-
Hi guys, I am making a game where a player can walk up walls and on ceilings. I have a player with a rigidbody and am freezing the rotation. I have an FMS for keeping a constant -y self force and moving the player forward with a z force. I also have this code that always keeps the bottom of the player aligned with the ground using a raycast and it works fine (always keeps the transform rotation flush with the floor). But I can not get it to work in playmaker. I downloaded all the custom actions required off the website (Quaternion.LookRotation, Transform.right) but just can't get it to work. Can anyone help? Thanks!
if (Physics.Raycast (transform.position, -transform.up, out hitDown, 2))
{
transform.rotation = Quaternion.Lerp (transform.rotation, Quaternion.LookRotation (Vector3.Cross (transform.right, hitDown.normal), hitDown.normal), Time.deltaTime * 5.0f);
}
-
Hi,
first, are you positive that this snippet works? if you have a scene with that script that works, I can then make it work as a 100% playmaker solution.
bye,
Jean
-
Thanks for responding Jean. Yes the code works. I tried to copy it in playmaker using two states that loop (detect raycast hit state, then rotation calculation state) but no luck. I am using a "next frame event" at the end of the "rotation calculation state" to return back to the the "detect raycast hit state". I also tried "wait" to transition back but no luck. In playmaker the player will align flush to the floor but when I rotate the player around (using the mouse) the player rotation gets all whacky and the player flips. But as I said the C# code works perfectly.
Thanks!
Matthew
-
Hi,
It really depends how this snippet is ran and when, so as I said, if you have a test scene where this is implemented, I'll be able to turn that into a 100% playmaker scene.
bye,
Jean