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 question

Previous Thread :: Next Thread 
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
14 Nov 2017 11:25 PM
if i have a CFrame such as:
CFrame.new(3,-1,-8) * CFrame.Angles(.2,-math.pi/2,-math.pi/2)
how could I add a vector3 to it such that the new CFrame would be
CFrame.new(0,-1,-8) * CFrame.Angles(.2,-math.pi/2,-math.pi/2)

this is boggling my mind...


Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
14 Nov 2017 11:26 PM
+ Vector3.new(-3, 0, 0)
Report Abuse
WillieTehWierdo200 is not online. WillieTehWierdo200
Joined: 13 Aug 2008
Total Posts: 1147
14 Nov 2017 11:39 PM
To add on to @CntKillMe's response, since you aren't changing the rotation of the CFrame, just the position, you are essentially "sliding" (technically known as "translating") the CFrame in the 3D space.

Mathematically, you can translate a point (the position) by adding a vector to it. Hence the answer above.


Report Abuse
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
14 Nov 2017 11:46 PM
WillieTehWierdo200 & cntkillme

youre right. I made a mistake. how would I translate the position when the rotation is variable?


Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
14 Nov 2017 11:49 PM
so you want to translate in world space or in the object space of the CFrame?
That is do you want it to go left 3 studs no matter the rotation or have it go towards its left 3 studs?
Report Abuse
WillieTehWierdo200 is not online. WillieTehWierdo200
Joined: 13 Aug 2008
Total Posts: 1147
14 Nov 2017 11:49 PM
First you would perform the translation (add the Vector3), then you would perform a rotation (multiply by a CFrame.Angles())


Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
14 Nov 2017 11:54 PM
No if he's translating in world space it doesn't matter if he rotates before he translates.
Report Abuse
WillieTehWierdo200 is not online. WillieTehWierdo200
Joined: 13 Aug 2008
Total Posts: 1147
14 Nov 2017 11:56 PM
Thanks, you are correct


Report Abuse
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
15 Nov 2017 12:23 AM
okay... what if I don't know the exact angles. Rather, I have I need to move something locally along the axis of the CFrame. Basically, I want to add Vector3.new(-3,0,0) along the orientation of the CFrame I am adding the vector to. Originally I thought PointToObjectSpace did this but now I'm not so sure.


Report Abuse
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
15 Nov 2017 12:28 AM
I know that if I have a CFrame with rotation: # # # # # # # # # then the corresponding Vector3 translation would just be -3,0,0 but if the axes were all rotated then the absolute Vector3 translation won't work anymore.
Report Abuse
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
15 Nov 2017 12:30 AM
rotation: (the rotation matrix of a CFrame that lines up with the world axes)
trying to type ones and zeros gets hashtagged ugh.


Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
15 Nov 2017 01:16 AM
CFrame * CFrame does that

part.CFrame = part.CFrame * CFrame.new(5, 0, 0)

would move it 5 units to ITS right
Report Abuse
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
15 Nov 2017 01:38 AM
ahh. One more thing. If I wanted to add a vector amount to a CFrame like before but instead of translating it by the CFrame's space, I want to add the vector to the CFrame along the axes of another CFrame with a different orientation than the CFrame I'm adding to.


Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
15 Nov 2017 02:00 AM
You can use vectorToWorldSpace for that

CF1 + CF2:vectorToWorldSpace(objSpaceOfCF2Vector)
Report Abuse
bigboy77584 is not online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
15 Nov 2017 11:21 AM
I was about to type how I was confused but I think I am starting to get it now.... thank you.


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