Jump to content


- - - - -

Making objects rotate towards a targeted coordinate.


4 replies to this topic

#1 BlinkerGuy

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 11 May 2006 - 06:29 AM

Hi. I am making a 3d space flight combat game.

I got the quaternion angles and semi-newton phsyics all set up. All I need to do is make CPU Objects rotate towards a specified X, Y, Z coordinate but not having the object instantly pointing at the Vector3 coordinate.

The current method I have now is, the rotation matrix system.
So when I want to rotate an object I do:

Pitch Object in X amount of units

So in that case the object get pitched X amounts of units for every game cycle loop. Does not set the actual rotation.

So again the only thing what I need to do is, get my RootMatrix to rotate towards(either pitch or yaw) to a targeted Vector3 coordinate one small unit at a time..

I am trying to figure out on how this could be done..

P.S. I use Direct3D/Artificial Engines Using VB.NET.

#2 juhnu

    Valued Member

  • Members
  • PipPipPip
  • 292 posts

Posted 11 May 2006 - 07:26 AM

You could use quaternions to represent both rotations, an original object and a destination rotation. To get rotations in-between these two you can use spherical interpolation between the two quaternions.

#3 BlinkerGuy

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 11 May 2006 - 02:17 PM

Is there some type of article on how this could be done?

I am having a hard time looking for somthing like this on google.

#4 moe

    Valued Member

  • Members
  • PipPipPip
  • 270 posts

Posted 11 May 2006 - 04:47 PM

You wrote that you are using Direct3D. This means you can use the D3D Functions instead of writeing your own.

They provide functions to bulid a matrix using a quaternion as rotation as well as they have functions to interpolate between two quaternions. Refer to the docu for more specifics.

Unless you want to write these functions yourself... Then i can's help you :)

#5 Aphex

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 15 May 2006 - 03:28 PM

If you have your physics set up as you say, it'd be better to apply a torque to turn your craft rather than just rotate it.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users