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: CFrame in relation to another CFrame

Previous Thread :: Next Thread 
NetherZero is not online. NetherZero
Joined: 25 Apr 2010
Total Posts: 316
10 Jul 2015 10:46 PM
How do I do it?
See, I'm saving tracks CFrames, and when it loads up, I don't want it loading up where the track used to be if the station is elsewhere. I want to save the CFrames in relation to my station, through station:GetModelCFrame()

Can I do this?
Report Abuse
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
10 Jul 2015 10:47 PM
If you set the model's PrimaryPart, you can use SetPrimaryPartCFrame to CFrame the entire model relative to that part's CFrame.
Report Abuse
NetherZero is not online. NetherZero
Joined: 25 Apr 2010
Total Posts: 316
10 Jul 2015 10:51 PM
The choice belongs user where to place the station. That is not an option.
Plus there are several hundred tracks.
I just want to "Get there CFrame in relation to the station"
Report Abuse
NetherZero is not online. NetherZero
Joined: 25 Apr 2010
Total Posts: 316
10 Jul 2015 10:52 PM
Get their*
Report Abuse
NetherZero is not online. NetherZero
Joined: 25 Apr 2010
Total Posts: 316
10 Jul 2015 10:59 PM
Same idea as making bricks spawn in a circle around another brick, depending on both where the brick is at and what its' current rotation.
Report Abuse
NetherZero is not online. NetherZero
Joined: 25 Apr 2010
Total Posts: 316
10 Jul 2015 11:13 PM
It's not hard, it just requires math and methods I don't know of...
Report Abuse
NetherZero is not online. NetherZero
Joined: 25 Apr 2010
Total Posts: 316
10 Jul 2015 11:54 PM
Bump
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
11 Jul 2015 12:00 AM
You know how you can do

Vector3B - Vector3A

to get the relative vector from A-->B? You can do the same thing with CFrames, but it's more like "adding a negative" because there's no 'subtraction' in CFrames. Technically, it would be "transforming by the inverse"

So to get the relative CFrame from A-->B you do

CFrameB * CFrameA:inverse() = relativeCFrame

And then, to get the position of B when you 'load' the object:

CFrameBOfRelativeObject = CFrameA * relativeCFrame

~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
11 Jul 2015 12:00 AM

You could always rotate the brick at a point found by rotation and distance, then
a. lerp it to it
b. set it to it

Not sure what you are asking.
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