Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Recommended Posts

How would I transform the following (or any other) vector to a 3D rotation without using a pivot as a buffer?  Can the Transform functions be used here or have I already found the easiest way?  Calling on any math guys out there... ;)

upDirection = Vec3(0.0f, 1.0f, 0.0f);
pivotAlignment->AlignToVector(upDirection, 1);
Vec3 _rot = pivotAlignment->GetRotation();			//_rot = Vec3(0.0f, 0.0f, 0.0f);
physicsParent->PhysicsSetRotation(_rot, 1.0f);

I don't want to use a pivot because, well, it just seems ugly.

Link to post
Share on other sites

The difficulty here is that a vector does not describe a 3D rotation. You need another term for roll, and your vector you used above demonstrates the exact problem, since it points straight up.

Mat4 mat;
Quat rotation = mat.GetQuaternion()

Note this will still have problems when pointing straight up.

  • Thanks 1
Link to post
Share on other sites

Those use the same code internally as this.

I'm not sure. The routine might just consider 90,0,0 to be "up" rotation. It will probably work okay. But just know that the engine is making a decision for you because the problem does not have one solution.

Link to post
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.

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...