Jump to content

How do i attach vehicle to an object?


yesyesok

Recommended Posts

Posted

I wanted to attach a vehicle to an invisible object, What functions should i use. It would be great if it's posted with a example.

I'm beginner lua scripter.

Posted

You need to use the AttachElements function.

Syntax:

bool attachElements ( element theElement, element theAttachToElement, [ float xPosOffset, float yPosOffset, float zPosOffset, float xRotOffset, float yRotOffset, float zRotOffset ] ) 

Example:

function attachObjects() -- Let's make a function 
    local marker = createMarker ( 0, 0, 10, "cylinder", 1.5, 255, 255, 0, 170 ) -- Creating the marker 
    local car = createVehicle(551, 0, 0, 10) -- Creating the vehicle 
     
    attachElements(marker, car) -- Now we have a marker that's attached into vehicle- 
end -- Close the function 

Posted
ik about attaching object but i'm asking how should i attach vehicle to objects?

I'm not 100% sure if you can, because I've never tried it.

If you can, it should just use the example that Miika gave with the marker and vehicle switched.

Posted

hey, I tried Alot but still i'm not able to attach vehicle to objects, I'm trying to make moving vehicle, So i decided to attach the vehicle to moving object and change the alpha of the objects, Objects are getting created but vehicles are not getting attached to it.

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