βurak Posted May 12, 2023 Share Posted May 12, 2023 (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 May 12, 2023 by Burak5312 Link to comment
Scripting Moderators xLive Posted May 13, 2023 Scripting Moderators Share Posted May 13, 2023 (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 May 13, 2023 by xLive 1 Link to comment
βurak Posted May 13, 2023 Author Share Posted May 13, 2023 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 xLive Posted May 13, 2023 Scripting Moderators Share Posted May 13, 2023 5 hours ago, Burak5312 said: attachElements(theObject,hunter) You should attach the hunter to theObject, not the other way around. attachElements(hunter,theObject) 1 Link to comment
βurak Posted May 13, 2023 Author Share Posted May 13, 2023 (edited) yes it worked now thank you I always make mistakes like this Edited May 13, 2023 by Burak5312 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now