Jump to content

Rotation Problem


Recommended Posts

Okay I am having a problem here with rotation of peds :S

I have this on my map file:

  
<spawnpoint id="buyer" skin="0" posX="-545.63269042969" posY="2577.0908203125" posZ="53.515625" rotX="0" rotY="0" rotZ="262" /> 
  

And now I want to create a ped on that position and with that rotation.

So I made this on Lua:

  
local buyer = getElementByID("buyer") 
local x,y,z = getElementPosition(buyer) 
local rot1, rot2, rot3 = getElementRotation(buyer) 
  
local buyerPed = createPed(14, x, y, z, rot1) 
  

I notice on the page https://wiki.multitheftauto.com/wiki/GetElementRotation, about the default order of rotation. and it says that retuns like Z,Y,X, so thats why I put rot1 on createPed function, anyway I tryed with rot2 and rot3 and it doesnt set the rotation..

Can someone help me here?

Thanks!!

Link to comment

Set is correct, get according to the wiki not (I can't confirm this, as I never experienced the problem :P) So, for the rotation parameters: '0, 0, rot1' should be correct in that case.

BUT, does getElement...() actually work on map files? I never tried this, so could anyone confirm this?

Link to comment
Set is correct, get according to the wiki not (I can't confirm this, as I never experienced the problem :P) So, for the rotation parameters: '0, 0, rot1' should be correct in that case.

BUT, does getElement...() actually work on map files? I never tried this, so could anyone confirm this?

yes it works, I manage to do many things with map files..

getting position of spawn .. get position of objects. but I am having problem with rotation :S

Thanks for your help

Link to comment

Oh, funny :P I always used get-attributes functions.

But did you try what I said? My rotations always work, though they're retrieved another way.

createPed ( 14, x, y, z, 0, 0, rot1 ) 

If rot1 doesnt work properly, use rot3. Idk what getElementRotation does on map elements.

Link to comment
Oh, funny :P I always used get-attributes functions.

But did you try what I said? My rotations always work, though they're retrieved another way.

createPed ( 14, x, y, z, 0, 0, rot1 ) 

If rot1 doesnt work properly, use rot3. Idk what getElementRotation does on map elements.

Thanks for your help, but the function createPed only receives on rot coord.

Its on wiki :

createPed ( int modelid, float x, float y, float z [, float rot = 0.0 ] )

:S

And I tryed what u said before, but didnt work too

Link to comment

Guys I forgot the .map file, and tryed just doing this:

local buyerPed = createPed(14, -545.63269042969, 2577.0908203125, 53.515625, 0)

on the second try:

local buyerPed = createPed(14, -545.63269042969, 2577.0908203125, 53.515625, 120)

on the third try:

local buyerPed = createPed(14, -545.63269042969, 2577.0908203125, 53.515625, 200)

And the ped keeps looking at the same point!! God dammn it ! lol

Thanks in advance

EDDIIIT: I tryed using setPedRotation ( ped thePed, float rotation ) and it works now!! But when I try to set the rotation on the createPed function it doesnt work :S is there some bug with this? if yes, can someone report to the mta team? I dont know how to do it.

Thanks!!

Edited by Guest
Link to comment

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