Jump to content
• Advertisement

#### Archived

This topic is now archived and is closed to further replies.

# Rotation from constrained particles

This topic is 5234 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

I''m using a constrained particle system for my rigid body system, and I have it working just as I want it to (or at least to a degree that I''m happy with it) But I''m having a problem where after all the constraints have been done I can''t seem to update my object to match my new shape defined by the particles translation is easy enough, I took the pre-update average position of the particles, and translated my object by the difference with the new average position I figured I could do the same for rotation by working out the change of rotation of a single particle from 0,0,0 (center of the object). But I can''t seem to get it working properly. After trying some quaternion idea''s I''ve dropped back to getting the change in euluer angles. Then applying that change to my object''s current rotation. That seemed to be a simple solution to me, but the angles seem either too exaggerated to too little... (Root being the modelspace position of my particle)
float2 Oldxz( OldRoot.x, OldRoot.z );
float OldYaw = atan2f( OldRoot.x, OldRoot.z );
float OldPitch = atan2f( OldRoot.y, Oldxz.Length() );

float2 Newxz( NewRoot.x, NewRoot.z );
float NewYaw = atan2f( NewRoot.x, NewRoot.z );
float NewPitch = atan2f( NewRoot.y, Newxz.Length() );

float YawChange = NewYaw - OldYaw;
float PitchChange = NewPitch - OldPitch;
anyway, 1) is there a better way to get the orientation from my particles'' new positions? 2) is there something wrong with that trigenometry (I can''t remember using inverse tan twice to get the picth & yaw before...) If it is okay, the problem probably just lies with my quternion code...

#### Share this post

##### Share on other sites
Advertisement

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
16
5. 5
• Advertisement

• 14
• 29
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631775
• Total Posts
3002275
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!