IDKBloxJoin Date: 2013-04-05 Post Count: 1304 |
Alright lol, let me explain. I want to make a 'Fly tool' And I wanna know the best way to rotate the body of the player in the direction the player is facing? if that makes any sense |
|
|
Use a BodyGyro on the player's character's torso. Make the body Gyro's CFrame be either the player's mouse's position or the direction the player's camera is facing... |
|
SoybeenJoin Date: 2010-02-17 Post Count: 21462 |
If the camera is locked to the torso, then you'll have to move the torso using the mouse delta, either by :SetPrimaryPartCFrame() or BodyGyro |
|
|
hmmmm...
well you obviously use cframe
either use a look vector at mouse.hit.p or you can use cframe.angles |
|
|
@Soybeen
I don't like using :SetPrimaryPartCFrame() because I feel that, without tweenservice, setting a part or model's CFrame isn't as smooth as BodyGyro. One can also easily edit the values in a body gyro to determine how the player's motion behaves. Ex:
BodyGyro.p -- How aggressively the body gyro rotates to the goal
How would you edit ^^ while using :SetPrimaryPartCFrame()? |
|
SoybeenJoin Date: 2010-02-17 Post Count: 21462 |
If you :SetPrimaryPartCFrame() on RenderStepped it's perfectly synced to their framerate, so it shouldn't be less smooth than a bodymover
|
|
IDKBloxJoin Date: 2013-04-05 Post Count: 1304 |
Well, I want it to be able to be used on mobile aswell, So I'd set the bodyGyro to the characters Root part cframe? + some numbers? |
|
SoybeenJoin Date: 2010-02-17 Post Count: 21462 |
I see what you're going for now.
Yes you would prefer BodyGyro for this case. Setting the BodyGyro directly to the mouse.Hit will suffice, but you should omit the Y component. You only want your bodyGyro to rotate you on X and Z. |
|
IDKBloxJoin Date: 2013-04-05 Post Count: 1304 |
What exactly do you mean? Like Gyro.CFrame = CFrame.new(cam.X,0,cam.Z) or something like that? |
|
SoybeenJoin Date: 2010-02-17 Post Count: 21462 |
BodyGyros ignore the first 3 positional components of a CFrame |
|
|