Problems with bodyvelocity

My brain is overheating.

30chars30chars

What is this

image

Sorry, i will try explain with a diagram,

First, your problem of your plane rotating wrong:

image

These are the rotation Axis, (orange = Z, Blue = X, Green = Y) They each rotate on their axis

You will notice Rotating the Y axis turns it left / right,

image

You will notice, you want to rotate the Plane on the Z axis, So your rotation should look a little something like this: BodyAngularVelocity.Velocity = Vector3.new(0,0,5), This will move the plane upwards.

You can make all of the rotation happen in one BodyAngularVelocity. like such:
BodyAngularVelocity.Velocity = Vector3.new(0,3,5), This will rotate it up and to the right.


As for the other things,
image
This is a remoteEvent, game.ReplicatedStorage.PlaneStarted.OnServerEvent:Connect(function()
(Sorry, i just noticed i wrote it wrong in the previous post)

This is how the plane will start.

Let me know if there’s anything else you want explained

1 Like

Oh my gosh, I have been mixing up positioning axis and rotation axis all the time.

1 Like

One thing, in the if statement you are not checking if the property has changed?
image

Exactly, the body angular velocity is constantly changed because it’s in a loop

Did what you said but it doesn’t work

local part = script.Parent.Parent.Main
local event = script.Parent.Plane
local going

event.OnServerEvent:Connect(function(plr, running)
	if running == true then
		print("Moving")
		going = true
		local i = Instance.new("BodyVelocity")
		local c = Instance.new("BodyAngularVelocity")
		c.Parent = part
		i.Parent = part
		i.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	elseif running == false then
		print("Not moving")
		going = false
		part.BodyVelocity:Destroy()
		part.BodyAngularVelocity:Destroy()
	end
end)
local seat = script.Parent
local Throttle = seat.ThrottleFloat
local Steer = seat.SteerFloat

local BreakLoop

function StartLoop()
	while wait() do
		if BreakLoop then break end	
			if Throttle then
				local PitchAngularVelocity
				PitchAngularVelocity = seat.ThrottleFloat
				part.BodyVelocity.Velocity = PitchAngularVelocity
			end
		
			if Steer then
				local SteerAngularVelocity 
				SteerAngularVelocity = seat.SteerFloat
				part.BodyAngularVelocity.AngularVelocity = SteerAngularVelocity
		end
	end
end

seat.Plane.OnServerEvent:Connect(function(plr)
	if seat.Occupant == plr.Character then
		BreakLoop = false
		StartLoop()
	end
end)

@InternallyAmplified

What doesnt work on it?

Do you have a remotevent in the seat? Are there any errors outputted?

1 Like

The plane doesnt move. Yes there is a remote event. No errors in the output.

It seems like your “P” Value for the BodyVelocity isn’t set.

i.P = Vector3.new(math.huge,math.huge,math.huge)

also, Simplify your code so you don’t have two remoteevent functions

local part = script.Parent.Parent.Main
local event = script.Parent.Plane
local going
local seat = script.Parent
local Throttle = seat.ThrottleFloat
local Steer = seat.SteerFloat

local BreakLoop

function StartLoop()
	while wait() do
		if BreakLoop then break end	
			if Throttle then
				local PitchAngularVelocity
				PitchAngularVelocity = seat.ThrottleFloat
				part.BodyVelocity.Velocity = PitchAngularVelocity
			end
		
			if Steer then
				local SteerAngularVelocity 
				SteerAngularVelocity = seat.SteerFloat
				part.BodyAngularVelocity.AngularVelocity = SteerAngularVelocity
		end
	end
end

event.OnServerEvent:Connect(function(plr, running)
	if seat.Occupant == plr.Character then
		BreakLoop = false
		StartLoop()
		print("Moving")
		going = true
		local i = Instance.new("BodyVelocity")
		local c = Instance.new("BodyAngularVelocity")
		c.Parent = part
		i.Parent = part
		i.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	else
		print("Not moving")
		going = false
		part.BodyVelocity:Destroy()
		part.BodyAngularVelocity:Destroy()
	end
end)
1 Like

For some reason stuff doesnt clone.

local part = script.Parent.Parent.Main
local event = script.Parent.Plane
local going
local seat = script.Parent
local Throttle = seat.ThrottleFloat
local Steer = seat.SteerFloat

local BreakLoop

function StartLoop()
	while wait() do
		if BreakLoop then break end	
			if Throttle then
				local PitchAngularVelocity
				PitchAngularVelocity = seat.ThrottleFloat
				part.BodyVelocity.Velocity = PitchAngularVelocity
			end
		
			if Steer then
				local SteerAngularVelocity 
				SteerAngularVelocity = seat.SteerFloat
				part.BodyAngularVelocity.AngularVelocity = SteerAngularVelocity
		end
	end
end

event.OnServerEvent:Connect(function(plr, running)
	if running == true then
		BreakLoop = false
		StartLoop()
		print("Moving")
		going = true
		local i = Instance.new("BodyVelocity")
		local c = Instance.new("BodyAngularVelocity")
		c.Parent = part
		i.Parent = part
		i.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	else
		print("Not moving")
		going = false
		part.BodyVelocity:Destroy()
		part.BodyAngularVelocity:Destroy()
	end
end)

EDIT:

Made a bit of testing and found out that this line makes the instance.new not work for some reason.
image

@InternallyAmplified

Ok, so I made some little changes but now I cannot drive it basically.

local part = script.Parent.Parent.Main
local event = script.Parent.Plane
local going
local seat = script.Parent
local Throttle = seat.ThrottleFloat
local Steer = seat.SteerFloat

local BreakLoop

function StartLoop()
	while wait() do
		if BreakLoop then break end	
			if Throttle then
				local PitchAngularVelocity
				PitchAngularVelocity = seat.ThrottleFloat
				part.BodyVelocity.Velocity = PitchAngularVelocity * 150
			end
		
			if Steer then
				local SteerAngularVelocity 
				SteerAngularVelocity = seat.SteerFloat
				part.BodyAngularVelocity.AngularVelocity = SteerAngularVelocity * 150
		end
	end
end

event.OnServerEvent:Connect(function(plr, running)
	print("Event fired")
	if running == true then
		BreakLoop = false
		print("Moving")
		going = true
		local i = Instance.new("BodyVelocity")
		local c = Instance.new("BodyAngularVelocity")
		c.Parent = part
		i.Parent = part
		print("Stuff parented")
		i.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
		i.P = Vector3.new(math.huge,math.huge,math.huge)
		
	else
		print("Not moving")
		going = false
		part.BodyVelocity:Destroy()
		part.BodyAngularVelocity:Destroy()
		print("Stuff deleted")
	end
end)