I have been into custom suspension systems lately, and I happened to create a suspension using a bodyposition. But I am having trouble detecting whether or not the thruster is on the ground, and applying no force to it when It is not on the ground.
Here is the model:
Keep in mind that it does not contain any code that will detect whether or not it is ‘grounded’
I just need someone to give me code that I can add on to this, so that way If it is on the ground, it will apply forces (To simulate a spring) and If it is not ‘grounded’ do not simulate a spring, and then just let the thruster freely (REALISTICLY) fall back to the ground (Then simulate a spring when it is on the ground). I have tried: raycasting to see whether or not the thruster is grounded, I have also tried using ‘BottomPart:GetTouchingParts()’ method to see if it works… but it does not!
You could try raycasting straight down from the center of your thruster, then check if there are any parts on ray . And then if there are you can calculate the distance using magnitude and if it’s within like 3 studs or something it can be considered on the ground. Just an idea.
I have already tried that. You can see here:
Is the ground in your map smooth terrain or parts?
https://gyazo.com/af5cadd100a241eb24c4d8e16fe026e7
So what I’m thinking of is you could detect when it touches the ground through .Touched and have another part above the terrain and when the thruster touches that it can be considered in the air. You would have to add a lot of debounces to make this work good though.
1 Like
Yes I will try that out in a sec, and if it does not work then I will let you know. Otherwise… It should work and I will accept this as a solution (For now) Thanks for the Help btw . I also can’t believe I forgot object.Touched is a thing lolol.
2 Likes
Your solution helped me! Thanks!