|
| 21 May 2016 07:27 PM |
How do I make a BodyGyro face another part with a side that isn't its front?
|
|
|
| Report Abuse |
|
|
| |
|
|
| 21 May 2016 08:10 PM |
First, you need to understand the Alcubierre metric. Idk how it's relevant, but I'll leave you to go read it before you finish my post.
Done? I hope not. You just wasted your time. Anyhow, back to the subject. You need to rotate CFrames. Here's an example of what to do.
BodyGyro.CFrame = CFrame.new(PartPos, TargetPos) -- Get the direction to the other part * CFrame.fromAxisAngle(Vector3.new(1, 0, 0), math.pi/2) -- Rotate it so that a different face faces it. -- Change the axis that the 1 or -1 is at in the Vector3 to get different faces.
|
|
|
| Report Abuse |
|
|
|
| 22 May 2016 03:20 PM |
Thanks for the reply.
What I'm trying to do is make a part face the player from the same orientation or side that it was facing the player with before a bodyGyro was inserted into it.
I don't understand what I need to the radian rotation to be set to so that the side facing me is the correct side.
I have something like this right now:
bodyGyro.CFrame = CFrame.new(marker1.Position, Player.Character.Head.CFrame.p)*CFrame.fromAxisAngle(marker1CFrame.lookVector, ?????)
marker1 is the part I want to face the player and marker1CFrame is its CFrame when it was stationary
How do I get the correct radian rotation to make the part face the player from the side that it was facing the player with when it was stationary?
|
|
|
| Report Abuse |
|
|
|
| 22 May 2016 09:25 PM |
I'm trying to recreate the Grab tool that you see in Lumber Tycoon 2.
In LT2, when you 'grab' an item, it doesn't change the orientation relative to you although it uses BodyGyro to face the player from the same orientation as before you picked up the item.
I only know how to make it face the player from the front face of the part, but not how to make it face from the same face that it was facing the player before he picked it up.
I think CFrame.fromAxisAngle is what I need to use but I do not know how I can get the radian measurement for the correct rotation.
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 22 May 2016 10:03 PM |
| use cframe to move the part but keep the rotation as the previous rotation as it follows your mouse |
|
|
| Report Abuse |
|
|
|
| 22 May 2016 10:09 PM |
If you PM me, I'll get it in the morning. I am a zombie at the moment. This is my favorite kind of question too. :( If Nox7 is online, you could also PM him and get a response sooner.
|
|
|
| Report Abuse |
|
|
|
| 22 May 2016 10:23 PM |
local OR = CFrame.new(TargetPosition, Torso.Position):toObjectSpace(TargetCFrame) -- Each time your set the gyro: Gyro.CFrame = CFrame.new(TargetPosition, Torso.Position) * TargetCFrame
That should work. I feel like it's doing more than I need to though to accomplish this task... I'm pretty tired. If someone mentions that it's redundant, I guess I can check this page in the morning. Good luck with it!
|
|
|
| Report Abuse |
|
|
|
| 22 May 2016 10:35 PM |
That worked! Thank you for the help!
|
|
|
| Report Abuse |
|
|
|
| 22 May 2016 10:45 PM |
actually no, that didn't work
|
|
|
| Report Abuse |
|
|
|
| 24 May 2016 03:13 PM |
actually yes, it did work!
thank you for the help!!
|
|
|
| Report Abuse |
|
|