Using Vec4 class

question
#1

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:

0 Likes

#2

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

#3

Thanks, but I still get error message.

0 Likes

#4

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

#5

Everything worked out! Thanks!

0 Likes