Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to put a gyroscope CFrame into Vector3?

Asked by
NsNidPL 41
5 years ago

Hello.

I am making a flight simulator and I am making controls for mobile using gyroscope. The output from gyroscope is a CFrame. How do I put a CFrame into Vector3? When I am trying to do so, everything is 0.

0
A CFrame contains a Vector3. You can use someCFrame.p to get the Vector3. User#5423 17 — 5y
0
then the vector3 is 0, 0, 0 NsNidPL 41 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

a CFrame consists of 2 vectors, for example;

CFrame.new(Vector3.new(0,0,0), Vector3.new(0,0,0))

the first vector determines the part's position and the second vector determines the part's orientation(where the part faces). To get a CFrame's position roblox has a neat function where you can type ".p" after a CFrame to get its position; for example,

CFrame.new(Vector3.new(0,0,0), Vector3.new(0,0,0)).p

this should give you the position; hope i helped.

0
Use Position instead, and your example is merely a constructor. User#24403 69 — 5y
0
that doesnt change the fact that its a example. TheluaBanana 946 — 5y
0
also people like to use .p cus its easier to type. TheluaBanana 946 — 5y
0
 not to mention this is just a casual discussion TheluaBanana 946 — 5y
View all comments (5 more)
0
anything else you would like to point out? im open for rational improvement TheluaBanana 946 — 5y
0
when i use .p all values in vector3 are 0, btw i figured out how to do it: lookVector :) NsNidPL 41 — 5y
0
"It's easier to type" argument is a bad argument User#24403 69 — 5y
0
@NsNidPL congrats TheluaBanana 946 — 5y
0
@sjr04Alt as long as it is an arguement TheluaBanana 946 — 5y
Ad
Log in to vote
0
Answered by
NsNidPL 41
5 years ago

i used lookvector and it works

Answer this question