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: Rotating a vector3 by a cframe?

Previous Thread :: Next Thread 
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
13 Jun 2016 04:13 PM
Basically, I want to rotate a Vector3 using a CFrame. I barely know vector math lol... How would I do it?
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
13 Jun 2016 04:27 PM
what does your question even mean???
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
13 Jun 2016 04:32 PM
Lets say I have a vector: (0, 0, 1).
I want to turn it into a new vector, (0.5, 0, 0.5). This vector is rotated 45 degrees to the right.
I want to be able to rotate it like that using CFrame.Angles(0, math.rad(45), 0) or similar.
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
13 Jun 2016 05:01 PM
yeah um.

vector3's don't have rotations.


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
13 Jun 2016 05:01 PM
"(0.5, 0, 0.5)"

no it's not. It's moved slightly.

Are you referring to lookvector?


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
neongoo51 is not online. neongoo51
Joined: 12 May 2009
Total Posts: 33061
13 Jun 2016 05:02 PM
If it was rotated 45 degrees around the origin, it would be (1/math.sqrt(2),0,1/math.sqrt(2)). Trust me, I know my trigonometry.

Either way, you should put (math.sin(math.rad(v)),0,math.cos(math.rad(v))), where v is the angle you want in degrees. math.rad() is for converting degrees to radians since RBXLua uses radians as the default unit for angles.

``Just wasting some space in your thread´´
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
13 Jun 2016 05:03 PM
Vectors can be used for either position or rotation.
ROBLOX uses them for both, for example Part.Position is a vector, and so is Part.Rotation.
I'm just not good at vector math in particular, so I'd love it if someone knew how I could do this.
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
13 Jun 2016 05:05 PM
@neongoo

I don't know the angle beforehand, all I have is a CFrame matrix and a unit vector that needs to be translated by the CFrame.
Report Abuse
ExtremeBuilder15 is not online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
13 Jun 2016 05:06 PM
You mean like this?

local part = game.Workspace.Part

part.CFrame = CFrame.new(part.CFrame*CFrame.angles(0,math.deg(45),0))
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
13 Jun 2016 05:06 PM
Specify that you mean lookvector next time.


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
13 Jun 2016 05:08 PM
It's not the lookvector of anything. It's just a vector with a length of 1.
Report Abuse
ExtremeBuilder15 is not online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
13 Jun 2016 05:10 PM
So a unit vector?
Report Abuse
veryveryveryhidden is not online. veryveryveryhidden
Joined: 16 Dec 2012
Total Posts: 486
13 Jun 2016 05:11 PM
CFrame.new(vector)*CFrame.Angles()
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
13 Jun 2016 05:12 PM
@ExtremeBuilder15

Yup. Not that it should matter, I should be able to rotate any vector by a CFrame, I just don't know how.
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
13 Jun 2016 05:13 PM
"It's not the lookvector of anything. It's just a vector with a length of 1."

it's a lookVector.

You want where this object is pointing to be offset from the part origin by the vector you provide. That's a lookvector


the power of the meme ( ͡° ͜ʖ ͡°)
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
13 Jun 2016 05:14 PM
Okay. Can you tell me how to rotate the vector by using the CFrame rotation?
Report Abuse
ExtremeBuilder15 is not online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
13 Jun 2016 05:15 PM
Go on the wiki, search up 3 topics, Euler Angles, Rotation Matrix, and Quaternions. That's all about rotation.
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
13 Jun 2016 05:21 PM
Believe me when I say I've tried. I'm not going to get any of this math without taking a math course thats one or two years too advanced for me. I came here to see if I could get a straight up answer, I already know of where I can find places to learn how to do it myself, but I want to be able to do it now.
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
13 Jun 2016 05:24 PM
Well you should be reading to learn now

Unless you are below 3rd grade, in which case you'd be learning to read instead
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
13 Jun 2016 05:28 PM
Does anyone know how to actually do this? I don't mind you guys giving out resources or advice on how to learn things, thats what most people here need, but what I'm looking for is an answer to the question in the original post.
Report Abuse
ExtremeBuilder15 is not online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
13 Jun 2016 05:33 PM
The question in original post is vague, rephrase it please.
Report Abuse
daireb is not online. daireb
Joined: 16 Nov 2012
Total Posts: 726
13 Jun 2016 05:36 PM
CFrame:vectorToWorldSpace(vector)

There, have fun
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
13 Jun 2016 05:42 PM
@daireb

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