Sign in to follow this  

Setting RotationY depending on two coodinates

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

This topic is 4688 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this