# DarkScience

Member

15

36 Neutral

• Rank
Member

2. ## Vector to Angle , and vice versa

What ??? Thats what i'm asking how to do. I've been getting an output which i posted here. seems to give. Angle: {P=0,Y=0,R=0} Forward: {X=0,Y=1,Z=0} Angle: {P=0,Y=90,R=0} Forward: {X=1,Y=6.12303176911189E-17,Z=0} Angle: {P=0,Y=180,R=0} Forward: {X=1.22460635382238E-16,Y=-1,Z=0} Angle: {P=0,Y=270,R=0} Forward: {X=-1,Y=-1.83690953073357E-16,Z=0} Angle: {P=0,Y=360,R=0} Forward: {X=-2.44921270764475E-16,Y=1,Z=0} [/quote] Y seems to be correct at 0,180,360 but incorrect in between. X seems to be correct at 0,90,270 but incorrect in between and oddly enough at 360. [/spoiler] second set [spoiler] double A_P = P; //math.DegreeToRadian ( P ); double A_Y = Y; //math.DegreeToRadian ( Y ); double A_R = R; //math.DegreeToRadian ( R ); normal.X = ( Math.Sin ( A_Y ) ); normal.Y = ( Math.Cos ( A_Y ) ); normal.Z = ( Math.Tan ( A_P ) ); [/quote] seems to give Angle: {P=0,Y=0,R=0} Forward: {X=0,Y=1,Z=0} Angle: {P=0,Y=90,R=0} Forward: {X=0.893996663600558,Y=-0.44807361612917,Z=0} Angle: {P=0,Y=180,R=0} Forward: {X=-0.80115263573383,Y=-0.598460069057858,Z=0} Angle: {P=0,Y=270,R=0} Forward: {X=-0.176045946471211,Y=0.984381950632505,Z=0} Angle: {P=0,Y=360,R=0} Forward: {X=0.958915723414307,Y=-0.283691091486527,Z=0} [/quote] Y is correct at 0 and incorrect every where else. X is correct at 0 and incorrect every where else. though the values are -1 to 1 which is the correct format. [/spoiler] [/quote] PYR are in degrees in second set... Seems to be a slight inaccuracy. I cant get it working properly even though from what i know second set should work fine. Ignore the Z = nonsense. Its just a placeholder. EDIT The issue is that when X or Y is suppose to be full (-1 ,0, 1) they are but the other number is 6.E~~~ (first set) EDIT AGAIN: Remember that 6.12303176911189E-17 is 0.00000000000000006 (I may have even missed a zero there!) so it is a very, very small deviation.[/quote] That's the issue i was having, now that i know what it is i can fix it. So my calculations are correct. Just a issue that i must work around. Also as to the -1 rating. Thanks. It means alot to me.
3. ## Vector to Angle , and vice versa

Oh and Alarvo http://en.wikipedia.org/wiki/Angle
4. ## Vector to Angle , and vice versa

Alvaro is incorrect. I explained that im looking for the direction not the absolute full 3d orientation. He should of figured given the deffinition of Angle. Alvaro thanks for this stressful encounter. Go to hell. clb thanks for an actual reply to my inquiry. Though go to hell for saying "Alvaro is correct". Sorry i thought he would understand that i'm trying to get a Angle not a Position or Vector.
5. ## Vector to Angle , and vice versa

Your numbers don't make sense. How can (0,270,0) be (-1,-1,0) ? Perhaps it is time for to go find a primer on 3D mathematics? As for converting between them, it looks like you want to project one unit along the forward vector of the orientation and find that position. As for reversing it, there are infinitely many orientations that can generate the forward vector. [/quote] Sorry wrote that in a hurry to represent the directions in relation to x,y,z not the proper numbers.
6. ## Vector to Angle , and vice versa

Thought it was clear from the code i posted. But i shall explain further. Also Can't be done isn't asking for a better explanation nor is not reading all that i posted advised when your goal is to understand what i am after. This is the object orientation in 3D space. -X is Left, +X is Right -Y is Backward , +Y is Forward -Z is Down , +Z is Up Now this is the view as in camera or object rotation. -Pitch is Down, +Pitch is Up -Yaw is Left, +Pitch is Right -Roll is Roll Left, +Roll is Roll right // this isn't as important right now The goal is to convert Pitch , Yaw , Roll to X , Y , Z and then back. So Angle( 0 , 0 , 0 ) would be in XYZ ( 0 , 1 , 0 ). So Angle( 0 , 90 , 0 ) would be in XYZ ( 1 , 0 , 0 ). So Angle( 0 , 180 , 0 ) would be in XYZ ( 0 , -1 , 0 ). So Angle( 0 , 270, 0 ) would be in XYZ ( -1 , -1 , 0 ). So Angle( 0 , 360, 0 ) would be in XYZ ( 0 , 1 , 0 ).
7. ## Vector to Angle , and vice versa

I guess I can't help you, since I don't understand anything. [/quote] Hoping you're not saying that in a sarcastic way in which your mad. I don't insult people in that way and wasn't implying anything by that comment. Also I believe i will try a more manual way of doing what it is i desire. By converting 0 to 360 to -180 to 180 and applying some arithmetic's to convert it to x and y.
8. ## Vector to Angle , and vice versa

first set [spoiler] double A_P = math.DegreeToRadian ( P ); // 0 to 360 double A_Y = math.DegreeToRadian ( Y );// 0 to 360 double A_R = math.DegreeToRadian ( R );// 0 to 360 normal.X = ( Math.Sin ( A_Y ) ); normal.Y = ( Math.Cos ( A_Y ) ); normal.Z = ( Math.Tan ( A_P ) ); [/quote] seems to give. Angle: {P=0,Y=0,R=0} Forward: {X=0,Y=1,Z=0} Angle: {P=0,Y=90,R=0} Forward: {X=1,Y=6.12303176911189E-17,Z=0} Angle: {P=0,Y=180,R=0} Forward: {X=1.22460635382238E-16,Y=-1,Z=0} Angle: {P=0,Y=270,R=0} Forward: {X=-1,Y=-1.83690953073357E-16,Z=0} Angle: {P=0,Y=360,R=0} Forward: {X=-2.44921270764475E-16,Y=1,Z=0} [/quote] Y seems to be correct at 0,180,360 but incorrect in between. X seems to be correct at 0,90,270 but incorrect in between and oddly enough at 360. [/spoiler] second set [spoiler] double A_P = P; //math.DegreeToRadian ( P ); double A_Y = Y; //math.DegreeToRadian ( Y ); double A_R = R; //math.DegreeToRadian ( R ); normal.X = ( Math.Sin ( A_Y ) ); normal.Y = ( Math.Cos ( A_Y ) ); normal.Z = ( Math.Tan ( A_P ) ); [/quote] seems to give Angle: {P=0,Y=0,R=0} Forward: {X=0,Y=1,Z=0} Angle: {P=0,Y=90,R=0} Forward: {X=0.893996663600558,Y=-0.44807361612917,Z=0} Angle: {P=0,Y=180,R=0} Forward: {X=-0.80115263573383,Y=-0.598460069057858,Z=0} Angle: {P=0,Y=270,R=0} Forward: {X=-0.176045946471211,Y=0.984381950632505,Z=0} Angle: {P=0,Y=360,R=0} Forward: {X=0.958915723414307,Y=-0.283691091486527,Z=0} [/quote] Y is correct at 0 and incorrect every where else. X is correct at 0 and incorrect every where else. though the values are -1 to 1 which is the correct format. [/spoiler] this is what im using to determine the accuracy of the values, they seem to slightly off in the second set though very close to what there suppose to be. Seems to increase in inaccuracy the larger the number. http://www.mathsisfu...Cosine, Tangent
9. ## Vector to Angle , and vice versa

You don't appear to understand the Vector/Angle model. It is possible and is done in just about every game out there. PYR can be converted to a normal which is a direction represented in XYZ and vice-versa. Also i may of just figured it out. Ensuring consistency now ... Never mind still don't have it ....
10. ## Vector to Angle , and vice versa

I'm currently trying to figure out how to convert XYZ to PYR. Here are my classes. Also i'm currently looking it up. I know of sin/cos. I'm learning what i can from online docs. Vector: [SPOILER] #region Properties public float X; public float Y; public float Z; public float Forward { get { return Y; } set { Y = value; } } public float Right { get { return X; } set { X = value; } } public float Up { get { return Z; } set { Z = value; } } #endregion #region Constructors public Vector( ) { X = 0; Y = 0; Z = 0; } public Vector( float x , float y ) { X = x; Y = y; Z = 0; } public Vector( float x , float y , float z ) { X = x; Y = y; Z = z; } #endregion #region Methods public Vector Normalize( ) { } #endregion #region Operators public static Vector operator +( Vector vector1 , Vector vector2 ) { return new Vector ( vector1.X + vector2.X , vector1.Y + vector2.Y , vector1.Z + vector2.Z ); } public static Vector operator -( Vector vector1 , Vector vector2 ) { return new Vector ( vector1.X - vector2.X , vector1.Y - vector2.Y , vector1.Z - vector2.Z ); } public static Vector operator /( Vector vector1 , Vector vector2 ) { return new Vector ( vector1.X / vector2.X , vector1.Y / vector2.Y , vector1.Z / vector2.Z ); } public static Vector operator *( Vector vector1 , Vector vector2 ) { return new Vector ( vector1.X * vector2.X , vector1.Y * vector2.Y , vector1.Z * vector2.Z ); } public static void operator ++( Vector vector ) { vector.Z++; } public static void operator --( Vector vector ) { vector.Z--; } #endregion [/SPOILER] Angle: [SPOILER] #region Properties public float P; public float Y; public float R; public float Pitch { get { return Pitch; } set { P = value; } } public float Yaw { get { return Yaw; } set { Y = value; } } public float Roll { get { return Roll; } set { R = value; } } #endregion #region Constructors public Angle( ) { P = 0; Y = 0; R = 0; } public Angle( float pitch , float yaw ) { P = pitch; Y = yaw; R = 0; } public Angle( float pitch , float yaw , float roll ) { P = pitch; Y = yaw; R = roll; } #endregion #region Methods public Vector Forward( ) { } public Vector Right( ) { } public Vector Up( ) { } #endregion [/SPOILER]

12. ## Multiple Inheritence.

Well this sucks, oh well. Guess i'll specify these things on a per class basis. Though 1 more thing. If i have a class with. public String SomeVariable = ""; and i cast another class that has that property defined to this one. will i be able to access its value ? (acces classA's version of the value ?) ClassA : ClassB
13. ## Multiple Inheritence.

My end goal is being able to inherit varius members from varius files without haveing to retype. Along with being able to use casting to invoke/access. where interfaces fail is the inability to specify values such as "public bool ShouldDoStuff = false;" or even specifying the members to be public/private. I will probably adjust my design model to something that uses interfaces. I'm just wondering if i can still assign values, use virtual, ect ... Thought it appears not so nuts to me, Time to get complicated or sloppy.
14. ## Multiple Inheritence.

What I am trying to accomplish is a form of inheriting multiple classes, I tried interfaces but they are rather limited, then i tried abstract classes. Everything seemed fine but as it turns out (as i forgot) a class can only have 1 base class. Is there a way to have a bunch of base classes and have them inherit/ be inherited ? Below is 2 of the class files im trying to inherit. interface - FAILED, cant enable external acces (public) for members, cant use virtual, cant specify default values class (abstract) - FAILED layer inheriting this inherits this which inherits that, i know this is a bad idea and wouldnt work. - NOT A GOOD IDEA , FUNDAMENTALLY FLAWWED [SPOILER] using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace game { public class ILogical { public bool ShouldLogic = true; public void Logic( float mul ) { if ( ShouldLogic ) OnLogic ( mul ); } public virtual void OnLogic( float mul ) { } } } [/SPOILER] [SPOILER] using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace game { public class IRenderable { public bool ShouldRender = true; public void Render( ) { if ( ShouldRender ) OnRender ( ); } public virtual void OnRender( ) { } } public class IDrawable : IRenderable { public bool ShouldDraw { get { return ShouldRender; } set { ShouldRender = value; } } public void Draw( ) { Render ( ); } } } [/SPOILER] Also found this, currently trying to make sense of it. http://msdn.microsof...y/64hstbtx.aspx
15. ## Just Starting GameDev

I've been looking into making a game for some time now, I have a great idea which I've been thinking on for a while. The issue is that i don't know what language to use and how to go about makeing my game. I've heard LUA would probably be my best choice. My game is going to by a 3D first person and overview type survival, strategy game. And for lack of better words use a form of voxel, though not necessarily. If you have any ideas as to what programs i should use for optimal performance and stability please post.