One simply Vex code.
It doesn't make sense When I type v@P += (0,@mask*3,0);
But it works to type v@P.y += @mask*3;
I want to know why? And how to write it correctly in the first way?
Why is it Wrong typing "v@P += (0,@mask*3,0); "?
658 3 0- jackdon4682
- Member
- 20 posts
- Joined: Aug. 2023
- Offline
- alexwheezy
- Member
- 318 posts
- Joined: Jan. 2013
- Offline
The first option will create the value of only the last element. You can check this if you write, for example,
You can see that the remaining elements have no effect on the expression.
To make it work as a vector you need to change the example a little.
v@P += (0,@mask*3,10);
To make it work as a vector you need to change the example a little.
v@P += set(0,@mask*3,10);
- jackdon4682
- Member
- 20 posts
- Joined: Aug. 2023
- Offline
alexwheezyOh, alexwheezy, thanks a lot!
The first option will create the value of only the last element. You can check this if you write, for example,You can see that the remaining elements have no effect on the expression.v@P += (0,@mask*3,10);
To make it work as a vector you need to change the example a little.v@P += set(0,@mask*3,10);
It works when I use set(0,@mask*3,10);
And I've noticed that claiming a vector should use {} instead of ()
so it also work when I type:
v@P += {0,5,0};
But be carefully ,it occur an error if you reference a property @mask ,like this:
v@P += {0,@mask,0};
so in my case, the best way is to use v@P += set(0,@mask*3,10); like you say.
- alexwheezy
- Member
- 318 posts
- Joined: Jan. 2013
- Offline
-
- Quick Links