script.Parent is a MeshPart. Could that be the problem? Also, I might be able to accomplish what I want. I am able to get the helicopter to rise up, and then move in a direction by setting the angular velocity, but the problem is trying to get it to slow down, and go back to just hovering/rising.
In this code, it starts off by going forward, waiting 2 seconds, and I want to reverse what the helicopter is doing. It just doesnāt do it though. It just keeps flying off in that direction, despite the huge number in the opposite direction. In fact, it seems like doing that just makes it fly even faster, even though I made it positive?
Hmm⦠perhaps itās the fact that Iām calling Vector3.new over a Vector3? Maybe all you need to do is
vf.Force = -(script.Parent.CFrame*Vector3.new(0,1,0))
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).
I ditched the angular velocity route, and started using torque, and it is looking promising.
It is easier to control! I think this is my best bet. In this gif, the helicopter rises and goes forward due to the torque, I then set it to angle back, the helicopter slows down because of this, and starts rising again. Now the challenge is to get the helicopter to rotate left and right
Iād just like to add: This error occurs because you cannot all the unary operator (-x) on CFrames.
Instead, they have a Inverse method:
Heli.CFrame:Inverse();
Aaaaaaah that makes a lot of sense. Thanks for catching my nonsensical CFrame mumbo jumbo.
So now that I have pretty good movement for a helicopter via torque and vectorforce, how would I go about stabilizing the helicopter with the torque, having it just hover in place? I just want to stop the helicopter tilting. Setting Torque to 0,0,0 obviously doesnt do anything, as torque just spins it.
Edit: Going to attempt to do it with an AlignOrientation object.
Edit 2: Donāt think that will help. Attempting to mess with vectorforce to stabilize
Edit 3: I suck at math too much for this
perhaps using a BodyPosition to keep it stablized?
I will try that, worried about if it will cause any lag to the server, repeatedly setting the position
maybe every once in every 0.1 seconds could reduce the lag?
edit: in every*
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.
But the problem is the vectorforce itself. Thatās the thing that doesnāt slown down. I need a way to implement some sort of drag system, which Iām not sure how to do. The helicopter would just keep flying forever in a direction if I didnāt stop it. I think Iāll try a bodyposition first. When no input for the helicopter is found, just repeatedly set the bodyposition to the helicopters current position (?) until it stops moving.
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 would gladly tween the vectorforce in a way that slows the helicopter down with drag when the user stops input, but I donāt even know where to begin in terms of math with that. I donāt know how to calculate how much velocity the helicopter needs to slow down
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?
Iāll give it a try, thanks. Never messed with bodyvelocity before.
Woah, not long into it and the results are promising! My helicopter was flying away, I set the bodyvelocity to 0,0,0 and it worked great! Thanks!
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.
Thanks. The only part now is to replicate the controls from the client to the server. Also, putting the player inside of the seat of the helicopter doesnāt work very well, so farā¦
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ā¦