Jump to content
  • Advertisement
Sign in to follow this  
firlefanz

Setting RotationY depending on two coodinates

This topic is 5057 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

Hello, I am not very good with Maths, maybe somebody can help me out. I have a planet with coordinates PX,PY,PZ. I have a Stargate flying around the planet with coordinates SX,SY,SZ. PY is equal SY, Y is up (0/1/0). this is working fine. Now I wnat my stargate to always point to the planet whereever it is. So I need to set MatrixRotationY with (Stargate.matrot,???) How do I get the value for the rotation depending on my coordinates? Thanks a lot! Firle

Share this post


Link to post
Share on other sites
Advertisement
You could make the planet and Stargate as one object. But that's maybe not what you want.

You can use one matrix if you make the Stargate's pivot in the center of the planet. But maybe that's not what you want either...

But at least I think that's the only solution... else you might have to change the Stargate's position and then rotate it afterwards.

Share this post


Link to post
Share on other sites
Hi!

Thanks for the answer, I am changing the stargates position every frame, it is rotating around the planet.

But it must be possible to rotate it depending on those two coordinates to point to the planet! I have the same problem with my starship, should be flying to a certain point. The question is what value to insert into MatrixRotationY.

I think it must be a formula with SX,SZ and PX,PZ.

Firle

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!