weird %worldPosition value when passing to a class method
by David Reynolds · in iTorque 2D · 07/18/2009 (9:08 pm) · 2 replies
I have the following:
onMouseDown will echo out a value like: '-34.166668 -16.875000' while fire will echo out '1311'. Why is the value changing?
If I change the code to:
both values are correct. (both '-34.166668 -16.875000')
Why doesn't the first example work?
function sceneWindow2D::onMouseDown(%this, %modifier, %worldPosition, %mouseClicks)
{
echo(%worldPosition);
$turret.fire(%worldPosition);
}
function turretClass::onLevelLoaded(%this, %scenegraph)
{
$turret = %this;
}
function turretClass::fire(%worldPos)
{
echo(%worldPos);
}onMouseDown will echo out a value like: '-34.166668 -16.875000' while fire will echo out '1311'. Why is the value changing?
If I change the code to:
function sceneWindow2D::onMouseDown(%this, %modifier, %worldPosition, %mouseClicks)
{
echo(%worldPosition);
fire(%worldPosition);
}
function fire(%worldPos)
{
echo(%worldPos);
}both values are correct. (both '-34.166668 -16.875000')
Why doesn't the first example work?
Torque Owner Bret Patterson