Rotation problem

So I’m making a placement system and this happens when the rotation reachs 270:


This is the script i’m using:

if Input.KeyCode == Enum.KeyCode.R then
	if RealRotation.X == 270 then
		RealRotation = Vector3.new(0, RealRotation.Y, RealRotation.Z)
	else
		RealRotation += Vector3.new(90, 0, 0)
	end
			
	TweenService:Create(workspace.BlockPreview, TweenInfo.new(0.25), {Orientation = RealRotation}):Play()
elseif Input.KeyCode == Enum.KeyCode.T then
	if RealRotation.Y == 270 then
		RealRotation = Vector3.new(RealRotation.X, 0, RealRotation.Z)
	else
		RealRotation += Vector3.new(0, 90, 0)
	end
	
	TweenService:Create(workspace.BlockPreview, TweenInfo.new(0.25), {Orientation = RealRotation}):Play()
end

This is because when an orientation axis is 360 or greater, the orientation axis goes to 0.

its not, the glitch happens when it goes from 180 to 270, not from 270 to 0

Try changing this value to 360 instead

it doesn’t fix it, that if only changes the rotation to 0 when pressing R when the block rotation is at 270, not when changing from 180 to 270

Maybe you should use CFrame, I Guess it better than Orientation.

1 Like

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