Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i make a Motor6d rotate in a loop?

Asked by 5 years ago

im experimenting motor6d for cars and use them for rotating wheels, but how do i make a motor6d rotate in a loop?

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

You could use a for loop, a while loop or others

You can see more on iteration and such here: https://developer.roblox.com/articles/Roblox-Coding-Basics-Loops

And you can see more on Motor6D here: https://developer.roblox.com/api-reference/class/Motor6D

It may be easier to just use hinges though.

Ad
Log in to vote
0
Answered by 5 years ago

You make a Motor6D rotate by setting the MaxVelocity property to something non-zero, and giving the motor a DesiredAngle to seek. It will spin until CurrentAngle reaches DesiredAngle. There should be no code loops setting the C0, C1, or Transform properties directly for the the purposes of making a Motor6D turn, as this completely defeats the ability for the Roblox engine to interpolation the motion smoothly on all clients. There are times when it's perfectly valid and necessary to manipulate the CFrames of a Motor6D, but for simply turning like a motor, it's made to do that without needing scripting updating it every frame.

0
Is it possible for the motor to spin forever until the cars throttle goes to 0? ieatandisbaconhair 77 — 5y
0
Yes, you can set the DesiredAngle very large, so large it would take years to reach, and considering a Roblox server stays up for a few days at most, that's as good as forever. EmilyBendsSpace 1025 — 5y

Answer this question