generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: BodyGyro question

Previous Thread :: Next Thread 
OppaGagnamSta is not online. OppaGagnamSta
Joined: 24 Sep 2014
Total Posts: 603
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
OppaGagnamSta is not online. OppaGagnamSta
Joined: 24 Sep 2014
Total Posts: 603
21 May 2016 08:05 PM
Is this a hard question?


Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
OppaGagnamSta is not online. OppaGagnamSta
Joined: 24 Sep 2014
Total Posts: 603
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
OppaGagnamSta is not online. OppaGagnamSta
Joined: 24 Sep 2014
Total Posts: 603
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 is not online. 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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
OppaGagnamSta is not online. OppaGagnamSta
Joined: 24 Sep 2014
Total Posts: 603
22 May 2016 10:35 PM
That worked!
Thank you for the help!


Report Abuse
OppaGagnamSta is not online. OppaGagnamSta
Joined: 24 Sep 2014
Total Posts: 603
22 May 2016 10:45 PM
actually no, that didn't work


Report Abuse
OppaGagnamSta is not online. OppaGagnamSta
Joined: 24 Sep 2014
Total Posts: 603
24 May 2016 03:13 PM
actually yes, it did work!

thank you for the help!!


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image