Jump to content

moving vehicles like moveObject


βurak

Recommended Posts

Posted (edited)

I need to move a vehicle in the same way as moveObject moves objects, that is, it will move from the current position to the target within a certain time.

how do i do this?

Edited by Burak5312
  • Scripting Moderators
Posted (edited)

The easiest way is to create an invisible object that has no collisions and attach the vehicle to it. That way, when you use the moveObject function, the vehicle will move along with it. Here are the functions you will need:

createObject
setElementCollisionsEnabled
setElementAlpha
attachElements
moveObject
 

Edited by xLive
  • Like 1
Posted

Thanks for writing to my post, I tried what you said, but when I attach the object to the vehicle, the object does not move, but if I do not attach it,

here is the code

local hunter = createVehicle(487,0,0,3)
local hx,hy,hz = getElementPosition(hunter)
local theObject = createObject(1337,hx,hy,hz)
attachElements(theObject,hunter)
setElementCollisionsEnabled(theObject,false)
moveObject(theObject,10000,hx,hy,hz+20) --does nothing

 

  • Scripting Moderators
Posted
5 hours ago, Burak5312 said:
attachElements(theObject,hunter)

You should attach the hunter to theObject, not the other way around.

Nzry7na.png

attachElements(hunter,theObject)
  • 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...