Coordinates behind a car

Hi guys,

I’m trying to do script that I need to find the coordinates behind a car. Basically, I have a truck here I attach a car and then I need to take the car, I need him to do behind the truck. I’ve tried the AttachEntityToEntity(car,vehicle,20… but it don’t work as I need.

Can someone help me?

Are you trying to get the coordinates, or are you trying to attach a vehicle behind another vehicle?

If you’re just after coordinates, use GetOffsetFromEntityInWorldCoords(). If you’re wanting to attach a vehicle, make sure you’re only passing the offset to AttachEntityToEntity(), and not world coordinates.

I already attach the vehicle. I want to release the vehicle (that part I already did) and then teleport the vehicle to behind the truck.

I tried user some math using the heading of the truck and position to find the coordinates but it doesn’t work. The car is always being teleport for one of the truck sides.

Then GetOffsetFromEntityInWorldCoords() is what you are after.

1 Like

Look at this native

thank you so much. Was really that :smiley: