Rotating a body around the y-axis

Chipmunk2D Bindings for the Unity3D engine
Post Reply
ensomniac
Posts: 17
Joined: Thu Sep 05, 2013 1:54 pm
Contact:

Rotating a body around the y-axis

Post by ensomniac »

Hey Guys,
Quick question that I'm hoping has a simple answer. I've implemented Chipmunk in my project and I need to rotate an object around its y-axis. Since Chipmunk controls the position, rotation and scale of the body, I can't simply do:

Code: Select all

gameObject.transform.rotation.eulerAngles.y = 45;
But I'd like to. My initial thought was to do

Code: Select all

Chipmunk.UpdatedTransform(gameObject)
But that didn't work.

I also tried:

Code: Select all

body.angle = 45;
Although I'm not sure that's what I'm after. I need to rotate this interactively in the game, not just at object creation.

Any help would be great. Thanks

Ryan
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Rotating a body around the y-axis

Post by slembcke »

You'll need to make a parent object and attach the ChipmunkBody to that. Same problem as with PhysX where the transform is locked to the body, but a little more strict since Chipmunk bodies can't rotate at all on the x or y axes.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
ensomniac
Posts: 17
Joined: Thu Sep 05, 2013 1:54 pm
Contact:

Re: Rotating a body around the y-axis

Post by ensomniac »

That makes sense. Thanks for the reply and clarification.

Ryan
compass3
Posts: 37
Joined: Fri Aug 30, 2013 4:27 pm
Contact:

Re: Rotating a body around the y-axis

Post by compass3 »

this post helps a lot. Thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests