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 ^_^

Founder of Kutmode - http://kutmode.com | https://discord.gg/P3FXVnF

(Retired) Leading Developer of Grand Theft International

(Retired) Leading Developer of Full Theft Auto.

(Retired) Owner of SourceMod.

  • 6 years later...
  • Moderators
Posted
On 22/06/2011 at 14:31, LoveFist said:

This will find the Z axis angle.
But how to find de X axis angle?

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

  • 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.

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

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.

6C73yFv.png

Did I help you?

Mmpe7Jm.gif


NeXuS™#0001

  • 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.

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

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.

6C73yFv.png

Did I help you?

Mmpe7Jm.gif


NeXuS™#0001

  • 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.

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

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

6C73yFv.png

Did I help you?

Mmpe7Jm.gif


NeXuS™#0001

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...