How to Work with Prop Movement in FiveM?

Hello everyone,

I am developing a script for my FiveM server and would like to know how I can work with prop (object) movement in the game. Specifically, I’m interested in learning how to make objects move in a controlled manner, such as making a tree fall or any other object move realistically.

I have a few specific questions:

  1. How can I detect collisions between objects in FiveM?
  2. What functions or methods are available to animate object movement?
  3. Is there a way to apply realistic physics to these objects, such as gravity and impact?
  4. How can I replace one object with another after the movement (e.g., replace a fallen tree with a log)?

Any guidance, code examples, or tutorials would be very helpful!

Thanks for the help! :grin:

3 Likes
  1. How can I detect collisions between objects in FiveM?

You can use IsEntityTouchingEntity or IsEntityTouchingModel to detect collisions.

  1. What functions or methods are available to animate object movement?

The best one I know of is SlideObject, as that’ll smoothly transition your object towards a end destination.

  1. Is there a way to apply realistic physics to these objects, such as gravity and impact?

Check out SetEntityVelocity, it lets you throw objects towards a direction with custom force.

  1. How can I replace one object with another after the movement (e.g., replace a fallen tree with a log)?

I’d just grab the coordinates & rotation of the entity by using GetEntityCoords and GetEntityRotation, delete the old entity, and create the object again as well as setting the coords and rotation with the values retrieved.

I can’t help more than that unfortunately (my hands hurt haha), but hopefully this helps you!

4 Likes

Hi PickleMods,

Thank you so much for your detailed response! Your suggestions are incredibly helpful. I’ve been following your work for a long time and really appreciate the quality and depth of your advice.

I’ll definitely try out the methods you mentioned for detecting collisions and animating object movements. SlideObject and SetEntityVelocity sound exactly like what I need. Also, the tip on replacing objects by grabbing coordinates and rotation is great

Thanks again for taking the time to help out, even with your hands hurting :laughing:. Your contributions to the community are always appreciated!

2 Likes

Incredible, I had the same doubts about the subject. I’m happy that there are people who like to help the community.

2 Likes