Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to put a gyroscope CFrame into Vector3?

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.

2 comments

0

A CFrame contains a Vector3. You can use someCFrame.p to get the Vector3.

0

then the vector3 is 0, 0, 0

2 answers

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.

9 comments

0

Use Position instead, and your example is merely a constructor.

0

that doesnt change the fact that its a example.

0

also people like to use .p cus its easier to type.

0

 not to mention this is just a casual discussion

0

anything else you would like to point out? im open for rational improvement

0

when i use .p all values in vector3 are 0, btw i figured out how to do it: lookVector :)

0

"It's easier to type" argument is a bad argument

0

@NsNidPL congrats

0

@sjr04Alt as long as it is an arguement

This discussion is preserved as it was. New answers, comments, and votes are closed.