Trying to change orientation of a model to 0 degrees

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
v:PivotTo(v:GetPivot():Lerp(v:GetPivot() * CFrame.Angles(0,0,0), 0.01))

The above line should make the model(v) lerp by 1% back to the original orientation which was 0,0,0. This is embedded in a loop to allow it to lerp all the way back to 0,0,0.
2. What is the issue? Include screenshots / videos if possible!
The issue is that it doesn’t error and it just stays where it is.
3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have checked far and low for a solution but there seems to not be much on this topic specifically. I tried different increments instead of the 1% every time(0.01). I have tried a lot and I really don’t see a problem with that statement.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

1 Like

I also tried this:

v:PivotTo(v:GetPivot():Lerp(CFrame.Angles(0,0,0), 0.01))

to no avail

1 Like

I’m not very good with CFrames, so I don’t understand the code much. What I’d do is create a temporary part and set its orientation since it is accessible from the BasePart, and copy its CFrame to the model, then Destroy the part. This method is pretty cheap though, I don’t recommend.

2 Likes

Unfortunately I already know that the correct orientation is 0,0,0 so I feel like that might not do anything but I appreciate the response. :slight_smile:

1 Like

Keep the original Position of the CFrame by saying CFrame.Position, but make sure you grab only its rotation by saying CFrame.Rotation, you can then Lerp the Rotation to whatever state you want, but you have to reconstruct the CFrame when doing so.

local ModelCF = Model:GetPivot() -- Model CFrame
local Pos = ModelCF.Position -- CFrame Position;
local Rot = ModelCF.Rotation -- CFrame Rotation

local Lerp = Rot:Lerp(NewCFrameAngle, Percentage) -- Lerp the Rotation
local NewCF = CFrame.new(Pos) * Rot -- Recreate CFrame with new Rotation.
-- if you lerp only the Rotation, it will set the Position back to origin, thats
-- why we are seperating its contents

If you want to keep it simple and only revert to 0,0,0, you can just put only the Position portion.

2 Likes

The issue could be with how you’re using the :Lerp() function.
The :Lerp() function interpolates between two values by a given fraction.

But, in your code, you’re trying to interpolate between the original pivot and a new pivot rotated by CFrame.Angles(0, 0, 0). Since CFrame.Angles(0, 0, 0) represents no rotation, the result will be the original pivot.

v.PivotTo(v:GetPivot():Lerp(CFrame.new(), 0.01))

^^^
If you want to lerp the pivot back to its original orientation, you should interpolate between the current pivot and the original pivot, not between the current pivot and a pivot with no rotation.

3 Likes

Thank you guys for your help, I am pretty sure both @DasKairo and @DiscoDino01 are both correct. I realized that multiplying the cframe.angles is basically adding the 0,0,0 to the current cframe. I see what you mean. Thanks again.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.