Remove Entity by GetEntityBoneIndexByName

Have been trying to look thru the natives and have had 0 luck finding anything that refers to removing a entity you found by boneindex. Say I find the wheel of a vehicle by GetWorldPositionOfEntityBone(vehicle, GetEntityBoneIndexByname(vehicle, ‘wheel_lf’). That will allow me to set marker around the entity since its getting the position. But is there anyway to get just the entity and not the pos to use DeleteEntity so it would just delete the right wheel.

SpikE

I don’t know if it works but, try to get bone index and use GetObjectIndexFromEntityIndex.

I will give that a try … thanks for the recommendation and will post here if it works.

First attempt didn’t work… but will keep playing around with it. If a vehicle can have the fender taken off from damage … should be able to remove it in general i would think.

Again thanks for the idea and ill keep playing with it.

SpikE

Hello! I know this is late, but does it actually work to delete bones using delete entity function?
Have you found the correct method of doing this?

Thanks!

I looked into it, but could not find anything that would delete by bone at all.

SpikE

I’ve also been wondering how this was achieved. It was recently demonstrated possible with Zolika1351's Trainer - GTA5-Mods.com

You can detach any vehicle part including the wheels, and it’s not using the setwheelxoffset method. The wheels actually get detached and lay on the road. I’ve been wondering how it was achieved for awhile now and so the answer is that there’s no native in FiveM for achieving this, but the method used in Zolika’s trainer was by disabling the bones. So to achieve this, you’d need to build a custom version of FiveM, otherwise it’s possible to do in SinglePlayer as demonstrated below.

You can use SetVehicleWheelTireColliderSize(vehicle, x, -5.0) where x = position of wheel, between 0 and 3 in addition with GetOffsetFromEntityInWorldCoords if you want to remove wheels from a spot as a mechanic for example

0 = Front Left
1 = Front right
2 = Rear Left
3 = Rear Right

I will give this a try… thnx for the info, will post back here when i start the script to say how it went.

SpikE

I tried it and it’s not the best way to do that…

Somebody already achieved it here for example https://forum.cfx.re/t/realistic-wheel-damage-standalone
But the code is encrypted.

1 Like

That’s my script, use wheel flags to remove the wheel collisions :slight_smile:

Can u give us more info how to dettach the wheel after that? @Kuzkay

I was able to disable wheel colission by WheelFlags and i moved wheel with SetVehicleWheelTireColliderSize so i achieved this that is kinda close.

Did you figure it out?

Yes, so basically there’s no native that will physically detach the wheel…
You can only disable collision and move the wheel to different place.

1 Like

What flag index is it? I can’t find any documentation for this anywhere.

Try -1, it’s about trying and playing with the natives/values sometimes.