I am attempting to make a motor change its angle from 0 to 0.001, and then back to 0 (to simulate the movement of a soft closing door of a vehicle.
It will NOT do this, and I’m not sure if this is an issue on my part or if this is a Roblox issue.
Soft Close Automatic BMW - YouTube (intended action)
It doesn’t do that, it just closes normally, and doesn’t attempt making that movement.
i’m pretty sure this goes into scripting support, and also can you show your script?
What type of motor are you talking about?
Motor6D or HingeConstraint.Motor?
I know Motor6Ds have issues with rotating at slow speeds or moving small amounts.
Would this even be noticeable on a Roblox vehicle though?
I’ve used HingeConstraints for my vehicle doors and it works just fine. The Roblox made cars in the Toolbox also use them.
They might work better for you too. Just set the door HingeConstraint to Servo, make the door close to within the last 2 degrees or so, pause, then fully close.
@XIX_X1X, it’s more a building issue. It’s not the script’s fault, it’s the hinge that’s the problem.
car = script.Parent.Parent.Parent.Parent
motor = script.Parent.Parent.Hinge.Motor
script.Parent.ClickDetector.MouseClick:Connect(function(player)
if car.CarValues.Locked.Value == false then
if motor.DesiredAngle == 0 then
script.Parent.OpenSound:Play()
script.Parent.ClickDetector.MaxActivationDistance = 0
motor.MaxVelocity = 0.05
motor.DesiredAngle = -1
wait(0.8)
script.Parent.ClickDetector.MaxActivationDistance = 32
else
script.Parent.ClickDetector.MaxActivationDistance = 0
motor.MaxVelocity = 0.05
motor.DesiredAngle = 0
wait(0.3)
script.Parent.CloseSound:Play()
wait(0.3)
motor.MaxVelocity = 0.001
wait(0.5)
motor.DesiredAngle = 0.01
wait(1)
motor.DesiredAngle = 0
wait(1)
script.Parent.ClickDetector.MaxActivationDistance = 32
end
else
script.Parent.DoorAttempt:Play()
end
end)
They’re motors that get instanced via script.
The simple ones that move on one axis. ('m too lazy to redo a lot of things to have hinge constraints)
And for the most part, they’re noticeable (I’m making this car for me so I like the little things that add realism)
Sorry, yeah a scripted Motor.
A hint for you, if you copy/paste a script here put 3 backticks (```) before and after your posted script so it shows up here with the proper formatting including the tabs at the beginning each line.
My experience is that anything lower than MaxVelocity of .004 won’t move so that could be your issue since you have it set for .001
motor.DesiredAngle = 0.01
wait(1)
motor.DesiredAngle = 0
Also remember that 0.01
radians is equal to 0.5729578 degrees, which isn’t really a whole lot. Maybe increasing that value to 0.02
which is about 1.15 degrees would make it noticeable, but not make it stick out too far either.
Unfortunately the motors don’t allow for a difference in angle below 0.04 Radians, and a difference that big looks like this:
I’m not sure why the difference has to be that big, but its not that big of a deal anyways.
Thanks for the help though.
Hard to tell from the dark image, but is the door inside the frame?
What if you close it up until the last .04 radians at the normal speed, then close it that last .04 radians at MaxVelocity .004? That might give an illusion of closing more like the video.
Just had a thought, why not Tween the CFrame of the door hinge in relationship to the body of the car? You could also change the EasingStyle to something like ‘Back’ to create the effect as well.