Jump to content

Object Rotation


d43dr4

Recommended Posts

Hello guys,

I have a question about objects rotation :oops:

I have this on my script:

function roo(ele) 
    local x,y,z = getElementRotation(ele) 
    setElementRotation(ele,x,y,z + 5) 
end 

time = setTimer(roo,100,0,ob) 

It works but it rotate and stucks less then a second

I want it not to stuck, just rotating like pickups :?

Thx

Link to comment

Put moveObject in the timer.

First, you create the object:

object = createObject ( model, x, y, z )

moveObject moves the object to a new position and adds a rotation to it, if you want to. What you want to do is move it to the same position it already is on (so it doesn't actually move) by using the same x, y and z as you used in createObject, but in moveObject you add a rotation.

Check out the page about moveObject:

https://wiki.multitheftauto.com/wiki/MoveObject

The rotation you fill in in moveObject is ADDED to the rotaion it already has. If you fill in 90, it rotates 90 degrees.

Put the moveObject in a timer:

setTimer ( moveObject, timerInterval, amountOfTimesToExecute, arguments... )

Arguments is what you fill in in moveObject, for example:

moveObject ( object, 1000, x, y, z, 0, 0, 90 )

This makes the object turn 90 degrees around theZ-axis in 1000 milliseconds = 1 second.

Put this in the timer:

setTimer ( moveObject, 1000, 0, object, 1000, x, y, z, 0, 0, 90 )

This executes the moveObject(object,1000,x,y,z,0,0,90) every 1000 ms. You have to fill in the same interval for the timer and moveObject, so it will stop moving when the timer makes it move again.

Good luck, you just have to change some numbers now.

Link to comment

Thats not change anything

When i just try to look on Original Briefcaserace script

I just dont think i can do it

its complicated

Exactly this part :

local x, y, z = getPedBonePosition(v.player, 35) 
local rx, ry, rz = getElementRotation(v.player) 
local xOffset = .1 * math.cos(math.rad(rz+90-90)) 
local yOffset = .1 * math.sin(math.rad(rz+90-90)) 
setElementPosition(v.briefcase, x+xOffset, y+yOffset, z-.2) 
setElementRotation(v.briefcase, rx, ry, rz+rotationOffset) 
if (v.hidden) then 
    v.hidden = false 
end 

Thanks guys any way

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