-
What do you want to achieve?
I have a model, I know how to change its position and how to rotate it. However, I cannot seem to figure out how to rotate that model based on a certain player’s torso.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Unfortunately, I have no found anything that works the way I want it to. At the moment I know how to rotate the model like this;
powerwave:SetPrimaryPartCFrame(powerwave:GetPrimaryPartCFrame() * CFrame.fromEulerAnglesXYZ(0,95,0))
In a nutshell I just want to rotate the model based on a players torso rotation.
Help will be appreciated.
1 Like
So, you can’t set the models rotation with the torso rotation, the rotations would be off, so in this case we set the models rotation to the torsos orientation. CFrame.fromOrientation is a good constructor func. (equivalent to fromEulerAnglesXYZ, use either one). And orientation is in degrees and CFrame needs radians, so we use math.rad, boom pow.
powerwave:SetPrimaryPartCFrame(powerwave:GetPrimaryPartCFrame()*CFrame.fromOrientation(math.rad(torso.Orientation.X), math.rad(torso.Orientation.Y), math.rad(torso.Orientation.Z)))
Hopefully this works :l
1 Like
This works perfectly. Thank you so much. However, the model spawns backwards. In other words, the other way around. How would I fix that?
Probably the rotation of the primary part, try manually turning it 180 deg.
that did not exactly work, but I basically rotated the model in the script before I did the torso rotation. Thank you so much