Game Development Community

Position arithmetic

by UCF_0017 · in Torque Game Engine · 09/05/2006 (10:21 am) · 4 replies

I am saving off the position information of an object in the world to a variable. Then, I am making the AI player move to that position. Unfortunately, the AI player is covering the trigger position I need to be accessible for Forte to walk on. So what I really need is the AI player to be able to move to the position of the trigger shifted in the X by a certain amount (in this case, let's say 20).

Right now, I have the following:


%targetObject = "MissionGroup/stageSoundTrigger";
%dest = %targetObject.position;
%dest.x = %dest.x - 20;
$AriasAlgo.goToDest(%dest, false);


Unfortunately, this is not working.

Neither did this:


%targetObject = "MissionGroup/stageSoundTrigger";
%dest = %targetObject.position;
%dest = %dest - "20 0 0";
$AriasAlgo.goToDest(%dest, false);

What should I be doing to get the result I want?

#1
09/05/2006 (10:22 am)
Forte is my main player. Sorry for not saying that.
#2
09/05/2006 (10:27 am)
%targetObject = "MissionGroup/stageSoundTrigger";
%dest = %targetObject.position;
%newdest = vectorSub(%dest, "1 0 0");
$AriasAlgo.goToDest(%newdest, false);


was the correct way
#3
09/05/2006 (10:29 am)
VectorSub(%dest,"20 0 0");
VectorAdd(%dest,"20 0 0");
#4
09/05/2006 (10:30 am)
Heh, a little to slow. Glad you found it.