|
| 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 |
|
|
|
| 13 Jun 2016 04:27 PM |
| what does your question even mean??? |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 13 Jun 2016 05:11 PM |
| CFrame.new(vector)*CFrame.Angles() |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 13 Jun 2016 05:14 PM |
| Okay. Can you tell me how to rotate the vector by using the CFrame rotation? |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 13 Jun 2016 05:33 PM |
| The question in original post is vague, rephrase it please. |
|
|
| Report Abuse |
|
|
daireb
|
  |
| Joined: 16 Nov 2012 |
| Total Posts: 726 |
|
|
| 13 Jun 2016 05:36 PM |
CFrame:vectorToWorldSpace(vector)
There, have fun |
|
|
| Report Abuse |
|
|
| |
|