So I have a plane and I’m using Mouse.Hit.p to determine how the plane should fly and rotation. However, when I aim it to the middle of my screen it jitters a lot and goes everywhere, has anybody had the same issue? Here is my code:
while true do
task.wait(0.1)
if ThrottleIncrease then
Throttle = math.clamp(Throttle + 1, 0, 100) -- The Throttle when increased is between 0 and 150. 150 is the max 0 is the lowest
end
if ThrottleDecrease then
Throttle = math.clamp(Throttle - 1, 0, 95) -- 100 should be fine.
end
if BodyVelocity.Velocity.magnitude >= 50 then -- having the magnitude 50+ should be an accurate description if the plane is on ground or not
InAir = true
else
InAir = false
end
if InAir then
BodyGyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
BodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BodyGyro.CFrame = CFrame.new(Seat.CFrame.p,Mouse.Hit.p) * CFrame.Angles(0,-3.14/2+1.6,Seat.RotVelocity.Y/3) -- 3 and 3
else
--BodyGyro.MaxTorque = Vector3.new(0,math.huge,0)
BodyVelocity.MaxForce = Vector3.new(0,0,math.huge)
end
The relevant stuff is when I set the BodyGyro and BodyVelocity.
Mouse.TargetFilter = Plane --change plane to variable which is a reference to the plane model
This will blacklist (filter out) the plane model and its descendants from being targeted by the mouse (being set as the instance value assigned to the “Target” property of the mouse object).
Hello! this significantly reduced the jittering and it rarely ever happens now but, when I make the mouse straight like not to either side of the plane the camera zooms in to my character then goes back out? I have seen this behaviour before but I am not sure what is causing it. Do you have any ideas?