Jump to content

Rotate ped to make him look at XYZ point


Ride1234

Recommended Posts

Posted

Good day, scripters :)

First, i know about setPedRotation and about wiki.multitheftauto.com too.

I want to rotate my ped to some point and make him look straight at it, but dont know how to calculate the angle of rotation. Can anyone help me?

P.S. I want to make a universal function that calculates rotation for any coordinates, so calculate rotation manually isn't a variant.

Posted (edited)

I've tried

  
math.abs(90+ math.deg( math.acos( math.abs(yvalbig-yvalsm)/(math.sqrt( (math.abs(xvalbig-xvalsm))^2 +(math.abs(yvalbig-yvalsm))^2))))) 

result - rotation is wrong.

Edited by Guest
Posted

go in local, go to a rotation you want and start runcode

Enter this: x,y,z = getElementRotation(getLocalPlayer()) outputConsole(x,y,z)

Look in your console after and you got your required rotation ^_^

  • 6 years later...
  • Other Languages Moderators
Posted
5 minutes ago, NeXuS™ said:

@Lord Henry, dont bump old posts, create a new one...

What's the problem with this? It's exactly the same content from the post.
I think is not necessary to create another post with the same content.

Posted

You arent having the same problem as @Ride1234 was having. It's a 2011 post, and this question got answered. You may bump an old post, if it was created by you, or you are having the same issue. But because this issue is already closed, you may create a new one, as YOUR support post, and maybe we could answer your question aswell, without having to read back into the 2011 comments, and functions.

  • Other Languages Moderators
Posted
3 minutes ago, NeXuS™ said:

You arent having the same problem as @Ride1234 was having. It's a 2011 post, and this question got answered. You may bump an old post, if it was created by you, or you are having the same issue. But because this issue is already closed, you may create a new one, as YOUR support post, and maybe we could answer your question aswell, without having to read back into the 2011 comments, and functions.

The post only answer about the Z axis, but I need to do it with the X axis...its the same content but not exactly the same problem.

Posted

I wanted to help ya @Lord Henry, because it would be easier for us, to answer your question, if you could write down your OWN problem, and not refer to other's. And btw, yeah, you can use MY signature, which I created for MYSELF, not for other's. Thanks for asking for it mate.

  • Other Languages Moderators
Posted
Just now, NeXuS™ said:

[...]And btw, yeah, you can use MY signature, which I created for MYSELF, not for other's. Thanks for asking for it mate.

Sorry by that...U want me to remove it?
By the way, I will create another post with this problem with X axis.

Posted

Nah, you can use it as it's a public image. But at least you could ask for it, if you have seen it, and you thought it's cool.

  • Like 1

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...