Jump to content

defining local coordinate system and then transforming to world coordi


bhaveshpandey

Recommended Posts

Hi, I'm working on a flocking system for my project. I need to define my local coordinate system and then transform it to world coordinate system for proper orientation.

I'm using the velocity as the heading vector, so I need to compute and then update the Side vector and the Up vector.

I guess these three would form a local coord system for each point to which the acceleration and velocities are applied.which would then be transformed into the world coordinate system??

Could anyone throw in any clues?

At the moment I have some issues to fix up as the movement doesn't seem to be correct. Here's a link to

a flipbook test:

test_001

cheers :)

Link to comment
Share on other sites

Hi, I'm working on a flocking system for my project. I need to define my local coordinate system and then transform it to world coordinate system for proper orientation.

I'm using the velocity as the heading vector, so I need to compute and then update the Side vector and the Up vector.

I guess these three would form a local coord system for each point to which the acceleration and velocities are applied.which would then be transformed into the world coordinate system??

Could anyone throw in any clues?

At the moment I have some issues to fix up as the movement doesn't seem to be correct. Here's a link to

a flipbook test:

test_001

cheers :)

My linear algebra is a bit rusty now. But I think if you got the velocity vector (V) and the original point world coordinate position (P0), P0+V = P1, you get the next point world coordinate position (P1). Sorry if I didn't interpret your question correctly.

Link to comment
Share on other sites

what you have suggested is correct and is something that i have done (to update the position in the end)..what I'm looking for is defining a local coordinate system for a point for it to be able to rotate and align properly with other points..

Edited by bhaveshpandey
Link to comment
Share on other sites

...but as your velocity is in a world space, thus other two cross vectors would be also. If you consider it to be object space (as object might have its transform too), you can multiply it by world transform of the object (or rotation matrix taken from that).

The need of space transformation is in opposite direction though, when you have an object/world space vector (position is just a matter of subtraction, but vectors (normals) need treatment by a rot matrix), and you'd like to express it in local point space coord, you build a matrix from its axis (nN, nUp, nSide) and mult a vector.

Link to comment
Share on other sites

thanks Symek..

so for instance if velocity is the heading vector how do I compute/update the up vector..could i simply set it to {0,1,0}??

but its needed to be updated with changing velocity while in simulation..any hints on that..

If I can get the Up vector then I can just take a cross product to set the side vector..

for some reason I cant get their movement right..they move with constant velocity instead of accelerating towards their sub flocks(even though I am using accelerations)..but my major concern right now is getting these vectors (velocity,up and side) right..

Link to comment
Share on other sites

thanks Symek..

so for instance if velocity is the heading vector how do I compute/update the up vector..could i simply set it to {0,1,0}??

but its needed to be updated with changing velocity while in simulation..any hints on that..

If I can get the Up vector then I can just take a cross product to set the side vector..

for some reason I cant get their movement right..they move with constant velocity instead of accelerating towards their sub flocks(even though I am using accelerations)..but my major concern right now is getting these vectors (velocity,up and side) right..

Im sure there is a more elegant way of doing this, but you could start with your v vector and up (0,1,0) and cross that to get your side as you have said. To get the "correct" up, you take the cross of the v and your new side vector. Essentially a double cross product to get the correct up on v.

This setup would fall over though if your particles are traveling straight up ie (0,1,0) so you would need to do some checks and if it is traveling up or near up then use a different "up" ie (1,0,0).

Again, probably a more elegant way of doing this.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...