I’m making a simulator game, and i wanna put a model into a specific CFrame position. That worked!
But its displaced, and i wanna rotate it by an script, once you press place it is there, but not rotated.
ONCE PRESSED: The card goes to the location but displaced:
This is how i would like it
The problem is, i dont know how to change the rotation of the
model how do you change rotation of a model?
After i clicked the button i tried this:
local mod = game.Workspace.icardx350:Clone()
mod.Parent = workspace
mod:PivotTo(CFrame.new(-60.265, -51.309, 263.029))
But rotation? Idk how?
Could someone help? Thanks!
December 19, 2022, 11:47am
Try add this
mod:PivotTo(CFrame.angles(0, 0, 0--add the right orientation here)) i dont know if this works for sure though.
Uhh i tried everything thats possible, uhh… somethings wrong…
add CFrame.Angles to your current PivotTo
mod:PivotTo(CFrame.new(-60.265, -51.309, 263.029) * CFrame.Angles(math.rad(--[[rotation in degrees here]]),math.rad(--[[rotation in degrees here]]),math.rad(--[[rotation in degrees here]]))
I cannot figure out how to do this, i’m bad at math’s… especially at coordinates
@AMisspelledUsernaem mentioned, you should add the rotation you want onto the cframe. this will rotate it. so let’s say you want to rotate it 10 degrees upwards, you do
mod:PivotTo(CFrame.new(-60.265, -51.309, 263.029) * CFrame.Angles(math.rad(0), math.rad(10), math.rad(0)))
this will add 10 degrees to the current rotation. using * (multiplication) is basically just adding it on for CFrames. I recommend playing around with it, you really don’t need to be good at math to understand degrees. if you really don’t get it, 90 degrees is a sharp 1/4 of a full turn. you can go from there.