mikedJoin Date: 2006-11-15 Post Count: 430 |
I have a constantly changing CFrame, with something like this inside it:
-67.0619431, 3.39999747, -22.9526978, 0.785206735, -7.05152733e-013, 0.619233727, 1.4891918e-013, 1, 9.49916578e-013, -0.619233727, -6.53665165e-013, 0.785206735
I want to be able to use the last and 3rd to last values (0.785 and -0.619) but cant think of a way of getting them out of the CFrame. I know to use CFrame.x, CFrame.y and CFrame.z to get the first three values out but there appears to be no way of getting anything else out...
Alternatively: You can make a brick face something by using
CFrame.new(Vector3.new(position), Vector3.new(position brick faces))
Is there any way of getting Vector3.new(position brick faces) out of a CFrame? |
|
Are92Top 100 PosterJoin Date: 2006-11-30 Post Count: 2771 |
eh... what is CFrame??? |
|
MrDoomBringerTop 100 PosterJoin Date: 2006-11-21 Post Count: 6176 |
I'm not sure what each value in a CFrame output is, you'd have to ask Telamon that. |
|
erik.casselTop 100 PosterJoin Date: 2006-02-27 Post Count: 443 |
Hmm, that's an interesting omission. I should add some index operators to CFrame. What's also missing is a rotation class, among other things.
Anyway, here's a workaround:
All ROBLOX value types implement the __tostring metamethod. This means you can call
tostring(foo)
on a cframe foo and get a string back with comma-separated values. This is the same string you get when you call
print(foo)
Now you can use the Lua string functions to split the string into a table, etc.
Ugly, but it should work.
Finally, I'd be curious to know what you want to access the matrix values for. In general you should be able to do everything using the CFrame operators and transform functions.
-Erik
|
|
mikedJoin Date: 2006-11-15 Post Count: 430 |
Thanks, I know exactly what you mean and the problem is now sorted.
I am testing a lot of stuff with player positioning and aiming. Im trying to make a snowboard at the moment and will need to know what angle the player is facing. Also I want a dancing minigame at minigame world (copy what the dancer in the middle of the stage is doing - if he faces left you face left, when he jumps last to jump is out etc (also a "Simon says" game could be possible). |
|
PCwienerJoin Date: 2007-03-03 Post Count: 3746 |
oo that sounds like fun! |
|
stang90Join Date: 2006-09-03 Post Count: 5633 |
i swear you guysjust make some of this up sometimes |
|
erik.casselTop 100 PosterJoin Date: 2006-02-27 Post Count: 443 |
I'll add the following functions in a future release:
CFrame:components() -- return 12-number tuple of translation and 3x3 rotation matrix
CFrame:toEulerAnglesXYZ() -- return 3-number tuple
|
|
mikedJoin Date: 2006-11-15 Post Count: 430 |
Thanks, the second one is especially useful |
|
Are92Top 100 PosterJoin Date: 2006-11-30 Post Count: 2771 |
rotation matrix?? WOW sound fun |
|
|
kool i cant wait and miked dont for get to update your admin door it still isnt leting me in and you said "i see you a lot in mini game world fox i geuss i can prmote you to admin" ok? ty
~ninetailfox~ |
|
snowwolfJoin Date: 2006-11-23 Post Count: 357 |
and I don't know a single thing the post said right after "I have a constantly changing Cframe, with something like this inside it:". I know I didn't really need to post this, but I think it's needed in this confusing paragraph that is so called a "post" :D |
|
|
I wish you would just supply an easier PitchYawRoll conversion and additions with CFRAMES instead of having to retrieve and update 12 parameters.
But oh well! |
|
jimmy347Join Date: 2007-02-25 Post Count: 700 |
Woow it kind of does sound fun! |
|
NilPillJoin Date: 2011-04-20 Post Count: 962 |
Bump |
|
dotHLPJoin Date: 2009-08-07 Post Count: 1110 |
So many old and cool people
R$340 | +1,575 | Certified Wizard |
|
|
|
|