I am trying to achieve a somewhat realistic helicopter movement. I am attempting to do this through the use of vectorforce and angular velocity. This is what I have so far:
(click on the broken image picture to open it)
I know that the angular velocity is causing the helicopter to rotate, which is intended, but now the vectorforce is pushing the helicopter in the direction it’s facing, causing it to over-rotate and plummet. How would I get around this? I could constantly update the Attachment’s Y orientation to be within a certain range, but I’m not sure how efficient that would be, and if that would mess things up. Any ideas what I should do? Is there an object that allows me to limit the angle the helicopter can be at? If this thing exists, I MIGHT be able to set the desired angle, and the vector force should do all the work, pushing it in the direction it is tilted. But then, crashing brings up a whole other problem…
Edit: Even if I could figure out a way to limit the rotation, it will still be relative to Attachment, still just sending it downwards at an angle. Not sure what to do I could make it not relative to the attachment but to the world, and I think I would use lookVector to accomplish this, if I am not using the Attachment anymore?
If you want to keep the rotation while maintaining a solely upward thrust, just rotate the body force in the opposite direction of the current orientation relative to the “up” direction.
I’m pretty sure it would look like this,
BodyForce.Force = Vector3.new(-Heli.CFrame *Vector3.new(0,1,0))
-- Force = Opposite rotation of Heli CFrame relative to the y axis(up).
I’m not sure if that works, but hopefully the logic at least makes some sense. Hope that helps.
Hmm… it doesn’t seem to make a difference in the syntax…
I’m pretty sure it has to do with trying to change a read-only property, hence the userdata thing. But the unm thing I’m not so sure. It could be that your Heli CFrame is just a reference, and not the actual CFrame itself? It would be helpful to see a snippet of code where you are applying this.
For your second script, changing the angular velocity - how does that slow down the force? All it does is change the rotation in the opposite direction. You need to change the vector force too (not sure if you are doing that already in a different script).
You could probably use a body gyro. They don’t have to be concurrently reset as long as you have simplified states for your helicopter. Moving -> set the gyro to the rotated orientation. Slowing down you would have it back to the initial orientation. The idea is that since you can control how fast body gyro reacts, it can slowly move to the intended position based on how fast you would like it to get there.
Hmmm… If you are afraid of constantly updating in a loop, you could resort to using TweenService for your bodyposition, or force or otherwise. Physics in Roblox is annoying because there are so many ways to do things and half of them don’t work
I think that’s where bodyvelocity works nicely, you just tween it right down to 0.
If you use your vectorforce, your drag would have to depend on how fast the helicopter is moving, which require you to reset the tween every frame. That’s not really optimal and would be better in a loop, which is still not what you are looking for.
I think a mix would suit your heli best. Keep your existing vector force - but when the player stops input, use a body velocity. The setup would be having the body velocity inactive when the player is providing input; when the player stops inputting, set the force to 0 and then set the velocity to the current velocity. Then you can tween the velocity down to 0, which will (hopefully) keep it at a constant height and stop any jittering.
I mean, it makes sense in my head - what do you think?
Congratulations so far. I’ve always opted not to use Roblox physics at all for this (if my profile desc doesn’t give it away too much) as you lose too much control, in my opinion. I tend to set desired orientations and take physics out of the equation, only using it for movement through bodyposition or even simply CFrame.
What’s the issue? I honestly rarely use the built in Seat/VehicleSeat, opting for either Weld or teleporting the player far away and changing the camera location.
Hey, I know this is like 3 years old but I was looking at this and wondering, how exactly did you get the helicopter to stabilize itself back to upright position? For me, when I set the torque to 0, it just continues to spin…