# playMaker

### Author Topic: Rigidbody messes with my rotation.  (Read 947 times)

#### Splankton

• Sr. Member
• Posts: 258
##### Rigidbody messes with my rotation.
« on: February 24, 2014, 09: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.
« Last Edit: February 24, 2014, 10:41:10 AM by Splankton »

#### jeanfabre

• Hero Member
• Posts: 14471
• Official Playmaker Support
##### Re: Rigidbody messes with my rotation.
« Reply #1 on: February 24, 2014, 11:16:37 AM »
Hi,

Tricky. I would use a special Lookat like this:

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

bye,

Jean

#### Splankton

• Sr. Member
• Posts: 258
##### Re: Rigidbody messes with my rotation.
« Reply #2 on: February 24, 2014, 12: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?
« Last Edit: February 24, 2014, 12:29:55 PM by Splankton »

#### jeanfabre

• Hero Member
• Posts: 14471
• Official Playmaker Support
##### Re: Rigidbody messes with my rotation.
« Reply #3 on: February 24, 2014, 10:02:07 PM »
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