x


addforceatposition starts off with a wonky change of rotation

I'm trying to do a simple bit of physics here where I'm using dummy objects attached to thrusters on a ship. I'm using AddForceAtPosition-- it seems to work, except, the first frame or two after setting the simulation in motion causes the rigidbody to rotate around the Y axis to a specific but unexpected angle.

This code is being executed on the fixed update:

MyGimbal.AddForceAtPosition( LThrust.forward * MyProfile.impulseFor, LThrust.position );
MyGimbal.AddForceAtPosition( RThrust.forward * MyProfile.impulseFor, RThrust.position );

LThrust and RThrust are transforms that are attached to the main object. They are essentially flanking the center of gravity, swept back slightly, with the forward axis parallel to the rigidbody's transform's forward axis.

What's odd, is it works brilliantly except for the part where it immediately flops around the y-axis to 243.3798; oddly specific and consistent.

All I can think of is that bit in the manual where it warns "Note that when position is far away from the center of the rigidbody the applied torque will be unrealistically large."

I like how it doesn't give any qualification of "far" Ultimately, this can't be the problem because it doesn't matter if I set the position to the actual position of the thrusters, or if I scale the offset down.

Changing drag doesn't effect it either.

I also thought maybe the first time the force is applied by one of the thrusters, that it's pivoting the rigidbody around by the 243 degrees or whatever, but if I swap the order, it still happens in the same direction.

What is going on here??

more ▼

asked Nov 27 '11 at 08:28 AM

Sinaz20 gravatar image

Sinaz20
1 9 10 12

CORRECTION: By "center of gravity" I, of course, meant "center of mass."

Nov 27 '11 at 07:59 PM Sinaz20
(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

Turns out I was assigning the transform's vector as a reference and altering it elsewhere in code-- my bad.

more ▼

answered Nov 29 '11 at 11:22 PM

Sinaz20 gravatar image

Sinaz20
1 9 10 12

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x10

asked: Nov 27 '11 at 08:28 AM

Seen: 572 times

Last Updated: Nov 29 '11 at 11:22 PM