Jump to content

moving vehicles like moveObject


Recommended Posts

  • Scripting Moderators

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
Link to comment

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

 

Link to comment
  • Scripting Moderators
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
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...