Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there another part movement method than CFrame/Position/MoveTo?

I've seen some places (Super Paper Mario and Deathrun 3, for example) that use some sort of Roblox Physics to make parts move.I'm not talking about motors (Rotation) I'm talking about movement. Deathrun 3 makes a 'hand' move on an invisible 'wire' that it goes along. I would like to know how to do this. Thanks in advance!

1 answer

✓ Accepted answer

Another method of movement is with the use of a BodyMover, which can achieve moving objects through the air. I have created an example that will move between four points with the use of a BodyVelocity and a BodyGyro.

local part = script.Parent
local gyro = part:WaitForChild("BodyGyro")
local velo = part:WaitForChild("BodyVelocity")

local nodes = { -- where the brick floats to
	Vector3.new(10,10,10);
	Vector3.new(10,15,-10);
	Vector3.new(-10,10,-10);
	Vector3.new(-10,5,10);
}
local speed = 10

local n = 1
local node = nodes[n]

while true do
	local d = (node-part.Position)
	local m = d.magnitude
	d = d.unit
	velo.Velocity = d*speed
	gyro.CFrame = CFrame.new(Vector3.new(),d)
	if m < 1 then -- if the brick is close enough to a point then move to the next
		n = n+1
		if n > #nodes then -- reached the end, restart
			n = 1
		end
		node = nodes[n]
	end
	wait()
end

1 comment

0

There is also the lerp method. Look for it in the wiki. I haven't done much with it but it can move a part from one point to another very quickly.

This discussion is preserved as it was. New answers, comments, and votes are closed.