Using Vec4 class


I start to learn haxe and constantly face problems that put me in a dead end. The language barrier does not allow me to form the correct requests, so I will create this topic in the hope of your help. Thanks.

Tell me please. Why does the application report an error? I wrestle the second day :frowning:



For creating new Vec4 constructor you have to add new before it and add value in brackets
and then call x axis of vec4 by variableName.x, example:

var xVec = new Vec4(1.0, 1.0, 1.0);// 1.0 are axis value xyz
object.transform.rotate(xVec.x , 0.01);
1 Like


Thanks, but I still get error message.



You actually had it almost right the first time, but Vec4.xAxis is a function, not a Vec4, so try this.

object.transform.rotate(Vec4.xAxis(), 0.01);

You don’t need to store it in a variable like xVec first. You can just pass it in like in the code sample above.

1 Like


Everything worked out! Thanks!