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: How would I apply rotation of one object to another object?

Previous Thread :: Next Thread 
Baseness is not online. Baseness
Joined: 07 Oct 2015
Total Posts: 1001
29 Oct 2017 12:56 PM
I have two identical parts; part A and part B.

The two parts are in different positions and different rotations.

How would I take the rotation of part A and apply it to part B without changing the position of part B to that of part A?

I can't figure this out.
Report Abuse
skydude221 is not online. skydude221
Joined: 15 May 2013
Total Posts: 5014
29 Oct 2017 12:58 PM
parta cframe = partb cframe
Report Abuse
Pastures is not online. Pastures
Joined: 15 Aug 2015
Total Posts: 943
29 Oct 2017 01:00 PM
That would change the position of Part A to Part B. I do not want the two parts to have the exact same position, just the same rotation.

How do I separate the rotation from the position in a CFrame?
Report Abuse
D3D9 is not online. D3D9
Joined: 20 Aug 2016
Total Posts: 87
29 Oct 2017 01:02 PM
#code
local part1, part2 = workspace.part1, workspace.part2;
part1.CFrame = (CFrame.new(part1.CFrame.p) * (part2.CFrame - part2.CFrame.p));


Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
29 Oct 2017 01:02 PM
--Get the displacement of the parts' positions
local disp = partB.Position - partA.Position

--Then, set B CFrame to A CFrame, and offset it by the original displacement
partB.CFrame = partA.CFrame + disp
Report Abuse
Relymx is not online. Relymx
Joined: 04 Apr 2010
Total Posts: 12
29 Oct 2017 01:05 PM
b.CFrame = (a.CFrame - a.Position) + b.Position
Report Abuse
Baseness is not online. Baseness
Joined: 07 Oct 2015
Total Posts: 1001
29 Oct 2017 01:09 PM
Exactly what I was looking for! Thanks guys!
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