Jump to content
  • 0

_x always returns 1


raymix

Question

hey guys, been stuck on this for hours now, tried tons of variations, nada...

{
	systemChat format["X = %1",getPos _x]; // only returns number 1, not an array of worldspace.
	systemChat format["X=%1,Y=%2,Z=%3 = ",getPos _x select 0,getPos _x select 1,getPos _x select 2]; // returns Y,Z properly, but X is always 1
}forEach array1; 

An array is filled up with objects that are collected from nearObjects, so basically I can do everything to tested items, like detach them, delete them or change colors, but I can not get proper X position in worldspace. It only returns proper Y and Z axis, but X is always 1 no matter what I do.

 

Is this intended or a bug?

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

hey guys, been stuck on this for hours now, tried tons of variations, nada...

{
	systemChat format["X = %1",getPos _x]; // only returns number 1, not an array of worldspace.
	systemChat format["X=%1,Y=%2,Z=%3 = ",getPos _x select 0,getPos _x select 1,getPos _x select 2]; // returns Y,Z properly, but X is always 1
}forEach array1; 

An array is filled up with objects that are collected from nearObjects, so basically I can do everything to tested items, like detach them, delete them or change colors, but I can not get proper X position in worldspace. It only returns proper Y and Z axis, but X is always 1 no matter what I do.

 

Is this intended or a bug?

 

use getPosATL for height above land, or getPosASL for height above sea level.

I believe getPos always returns a specific value for height.

Link to comment
Share on other sites

  • 0

Vamp, I've tried them all, even tried working around with modelToWorld and setVariable,, they all return 1 for x axis.... y and z always returns proper values. it's not the height I want, it's the first variable in worldspace array that seems to always return 1. 

Link to comment
Share on other sites

  • 0

Try this:

{
    private["_temp"];
    _temp = _x;
    systemChat format["X = %1",getPos _temp];
    systemChat format["X=%1,Y=%2,Z=%3 = ",getPos _temp select 0,getPos _temp select 1,getPos _temp select 2];
}forEach array1; 

It's possible _x have a different value inside format[]. I didn't try it, I just remember on something like that.

Link to comment
Share on other sites

  • 0

 

Try

{
	systemChat format["%1", (getPosATL _x)];
} forEach array1;

That did the trick, thanks man.... damnit arma!!!!

Syntax of this engine has been nothing, but pain... but it (by it I mean tons of errors) gets me to a point where I finally comfortably write code from scratch, so I got that going for me, which is nice...

Link to comment
Share on other sites

  • 0

Try this:

{
    private["_temp"];
    _temp = _x;
    systemChat format["X = %1",getPos _temp];
    systemChat format["X=%1,Y=%2,Z=%3 = ",getPos _temp select 0,getPos _temp select 1,getPos _temp select 2];
}forEach array1; 

It's possible _x have a different value inside format[]. I didn't try it, I just remember on something like that.

Tried that already, mate. Thanks anyway.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...