I want the part to keep its original rotation but also rotate WITH the player.
You want it to move around with the mouse, but keep itās rotation?
Yes 298472984729834729847239472424
Simple, you donāt need a rotation.
Just set the CFrame of the part to the position you want it at, excluding the CFrame. Like this:
part.CFrame = CFrame.new(cframeOfRaycast.Position)
This will exclude rotation.
If this moves the part without rotating it, thats not what I want. I want the part to rotate WITH the player so if the player picks it up, the part will face the player with its orignal rotation from when it was first picked up
Okay, so save the rotation of the player when they first pick it up, and set it to the position of the raycast, and then multiply it by the .Rotation
of the CFrame you saved.
It didnāt work I think. Can you give me code and explain how it works?
Itās simple. Save the CFrame
of your character when you first pick it up, get the position that you want to set the part to, put that position into a new CFrame
, and then multiply that cframe by the .Rotation
of the CFrame
you saved.
I donāt want the part to rotate when it gets grabbed. I want it to rotate when it is moving/being dragged. So a start rotation(the rotation of the part when it got grabbed) and it rotating along with the direction of the player.
So you want it it to only follow the Y rotation of the character, while itās moving? Simple, get the Y rotation of the character, and multiply it by the parts CFrame
local _, y, _ = character:GetPivot().Rotation:ToOrientation()
part.CFrame *= CFrame.new(mousePosition) * CFrame.Angles(0, y, 0)
No not just the Y rotation. The original problem was me not being able to make the Y rotation work. I want all rotation axis to work.
It would save an awful lot of time if you could post the place for people to mess around with, otherwise we have to write a grabbing system and test methods of fixing it ourselves (which wonāt fix yours!). Without that all we can do is make our own grabber system to play around with. Or even worse, mentally visualise solutions that might work for your grabber system, then type them out to you as a reply, and then wait for a response.
Itās SOOO hard to understand what youāre saying without an example, Iāve tried to write a script for every combination of everything you could possibly be wanting, and itās not what you want, can you find an example?
Thatās great, thank you. The issue is the method you chose to click and activate the block. We might chose a different method and will struggle to help with your system. Iāll have a tinker now.
local playerPosition = character.Head.Position
local grabbedPartPosition = grabbedPart.Position
local lookAtCFrame = CFrame.lookAt(playerPosition, grabbedPartPosition)
local lookAtOrientation = lookAtCFrame:ToOrientation()
local lookAtOrientationDegrees = Vector3.new(math.deg(lookAtOrientation.x), math.deg(lookAtOrientation.y), math.deg(lookAtOrientation.z))
local orientationDifference = lookAtOrientationDegrees - baseOrientation
grabbedPart.Orientation = grabbedPartBaseOrientation + orientationDifference
Ngl anytime thereās a CFrame question on this forum I just use google n copy n paste n hope it works or close enough because bro CFrame should not be this hard but it is.
This is WAYYY too over complicated. Simply use this:
part.CFrame = CFrame.new(mousePos, character:GetPivot().Position)
No they want it based on the characters looking direction not where the mouse is. I think, unless I misunderstood the question?
He knows what Iām talking about, wherever heās casting and getting the position to set the part to, thatās mousePos
.
Iām not sure you understand how this function works, because thatās exactly what it does.