[Solved] Scripting: SetAngles
Quote from Sprowl on June 9, 2012, 9:20 pmHeyho,
currently I'm trying to parent a func_physbox with some special behaviors to a model. That works fine. Also the teleporting with a script of a second func_physbox to that models location is part of the project, and all that is working.
But the problem I have at the moment is the setting of the angels to the physbox (I want the angels of the model and put them into the func_physbox).
I can easily get the oriantation of the model with
- Code: Select all
local ang = modelOrigin.GetAngles();
but I just get error messages when I try to put these informations to that physbox with:
- Code: Select all
physBox.SetAngles(ang[0],ang[1],ang[2]);
The error I get:
- Code: Select all
AN ERROR HAS OCCURED [the index '0' does not exist]
CALLSTACK
*FUNCTION [cubeIsGeled()] reflectioncubeparent.nut line [10]
*FUNCTION [main()] InputRunScript line [1]LOCALS
[ang] INSTANCE
[this] TABLE
[this] TABLE
Entity ReflectCube1Phys encountered an error in RunScript()To raise the numbers (1,2,3 or 2,3,4 ... ) doesn't help. Isn't there a way to print the whole array itself in squirrel, like in php with print_r (I know they are different languages, php is just the only one I'm good at)?
Heyho,
currently I'm trying to parent a func_physbox with some special behaviors to a model. That works fine. Also the teleporting with a script of a second func_physbox to that models location is part of the project, and all that is working.
But the problem I have at the moment is the setting of the angels to the physbox (I want the angels of the model and put them into the func_physbox).
I can easily get the oriantation of the model with
- Code: Select all
local ang = modelOrigin.GetAngles();
but I just get error messages when I try to put these informations to that physbox with:
- Code: Select all
physBox.SetAngles(ang[0],ang[1],ang[2]);
The error I get:
- Code: Select all
AN ERROR HAS OCCURED [the index '0' does not exist]
CALLSTACK
*FUNCTION [cubeIsGeled()] reflectioncubeparent.nut line [10]
*FUNCTION [main()] InputRunScript line [1]LOCALS
[ang] INSTANCE
[this] TABLE
[this] TABLE
Entity ReflectCube1Phys encountered an error in RunScript()
To raise the numbers (1,2,3 or 2,3,4 ... ) doesn't help. Isn't there a way to print the whole array itself in squirrel, like in php with print_r (I know they are different languages, php is just the only one I'm good at)?

Quote from ChickenMobile on June 10, 2012, 12:58 amWhat is in ang[0]? According to the error it says that there is nothing inside the array: ang at index 0. That is because ang is not an array but an INSTANCE.
Try referencing each angle variable of ang as ang.x ang.y ang.z.EDIT: to display contents of something use the print() or printl() command.
What is in ang[0]? According to the error it says that there is nothing inside the array: ang at index 0. That is because ang is not an array but an INSTANCE.
Try referencing each angle variable of ang as ang.x ang.y ang.z.
EDIT: to display contents of something use the print() or printl() command.
Quote from Sprowl on June 10, 2012, 8:57 amIt says that ang is a vector with three values inside (pitch, yaw, roll). Because of that i just thought about an array.
ang.x/y/z worked. Thank you!
It says that ang is a vector with three values inside (pitch, yaw, roll). Because of that i just thought about an array.
ang.x/y/z worked. Thank you!
Quote from FelixGriffin on June 10, 2012, 3:37 pmSorry about that, Sprowl. The script I gave you doesn't work because of that. I'm used to C++ vectors with overloaded [] operators.
Sorry about that, Sprowl. The script I gave you doesn't work because of that. I'm used to C++ vectors with overloaded [] operators.

Quote from BenVlodgi on June 12, 2012, 1:25 amFelixGriffin wrote:Sorry about that, Sprowl. The script I gave you doesn't work because of that. I'm used to C++ vectors with overloaded [] operators.ahh silly C++, I know its so cool and everything, but man I love C#
and I was really happy to see this post.... because it was finally not a question of...all these PeTI puzzlemakers wrote:how can I brush this texxure into sticky gel cakelololololI also like to make VScripts, so it was interesting
ahh silly C++, I know its so cool and everything, but man I love C#
and I was really happy to see this post.... because it was finally not a question of...
I also like to make VScripts, so it was interesting