Jump to content

Turning objects towards other objects


Andy Gilbert
 Share

Recommended Posts

Just wondering how i can turn objects towards other ones. I know there is "point" I want be able to do this just on the Y axis, not all the others.

 

Thanks

Andy

The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do.

 

Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d

Link to comment
Share on other sites

The axis argument is the axis to point, and I think he wants control of the axis it rotates around.

 

If you want to rotate around the Y axis, find the XZ vector between the two entities. Something like this will do it:

Vec2 v = entity0->GetPosition(true).xz() - entity1->GetPosition(true).xz();
float angle = Math::ATan2(v.y,v.x);
entity0->SetRotation(0,angle,0);

My job is to make tools you love, with the features you want, and performance you can't live without.

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.

 Share

×
×
  • Create New...