Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Splankton on February 24, 2014, 11:50:04 AM

Title: Rigidbody messes with my rotation.
Post by: Splankton on February 24, 2014, 11:50:04 AM
I have my gameobject rotating it's y axis which is based on static cubes that are placed around the map.  It rotates fine, except when I add a rigidbody.  I have to use a few constraints on the rigidbody, but now my rotation doesn't work right.
I need a rigidbody as I want to add forces and use gravity.  So I'm thinking I need to change my rotation logic, but all I have is a raycast pointing to the cubes and returning it's y axis, then setting that y rotation to my gameobject.
Is there a way around this? Or a better way.  I really need to use a rigidbody.
The best way to descibe it, is imagine a car moving along a path (which isn't set) and as it moves, its rotating its Y, so it faces forward.
Title: Re: Rigidbody messes with my rotation.
Post by: jeanfabre on February 24, 2014, 01:16:37 PM
Hi,

Tricky. I would use a special Lookat like this:

http://wiki.unity3d.com/index.php/TorqueLookRotation

bye,

 Jean
Title: Re: Rigidbody messes with my rotation.
Post by: Splankton on February 24, 2014, 02:03:52 PM
Thanks I'll take a look.  One thing though, that script looks for a target. I don't use one because the player can move up/down as it moves forward by itself. If I can't get this script working can you think of another way I can rotate the player along a track?
Title: Re: Rigidbody messes with my rotation.
Post by: jeanfabre on February 25, 2014, 12:02:07 AM
Hi,

 what is your track made of? a target can be anything, it could be a gameobject that is setting its own position based on the direction of the player, or based on the next unit on a spline compare to the player position on that path.


Bye,

 Jean