Moving a box
by Tasty Green Pees :-, · in Torque Game Engine · 04/29/2006 (7:00 am) · 6 replies
I apologise for the simplicity of this question. I've looked around but can seem to find the answer. But I know its just a simple command.
I got and object and I'd like it to move a certain displacement up.
I cannot use the setMoveDestination because this only works with AIs.
what command should I use to get the object to move. it is a simple box which represents a door
here is my code:
setMoveDestination isn't working ofcourse.
I got and object and I'd like it to move a certain displacement up.
I cannot use the setMoveDestination because this only works with AIs.
what command should I use to get the object to move. it is a simple box which represents a door
here is my code:
%doorPos = $CURRENT_DOOR.getPosition(); %x = getWord(%doorPost, 0); %y = getWord(%doorPost, 1); %z = getWord(%doorPost, 2); %z += 300; $CURRENT_DOOR.setMoveDestination(%x @ %y @ %z);
setMoveDestination isn't working ofcourse.
About the author
#2
It's pretty silly, but there is no function to move objects out of the box.
There is the pathshape class. you could look up info on that resource and see if it will do the trick. Or... you could figure out how the setmovedestination works in the c++ code, and make one for shapebase. I might have to do that one.
04/29/2006 (9:05 am)
.setmovedestination only works with aiplayer classes, sadly.It's pretty silly, but there is no function to move objects out of the box.
There is the pathshape class. you could look up info on that resource and see if it will do the trick. Or... you could figure out how the setmovedestination works in the c++ code, and make one for shapebase. I might have to do that one.
#3
04/29/2006 (10:04 am)
EEK TYPO!!! BIG TIME!
#4
strangely rather than moving 1 unit to the along the z it moves 100 units!?!?!
why is this?
04/29/2006 (10:20 am)
I've corrected the function so it read like this:function openDoor() {
%doorPos = $CURRENT_DOOR.getTransform();
echo(%doorPos);
%x = getWord(%doorPos, 0);
%y = getWord(%doorPos, 1);
%z = getWord(%doorPos, 2);
%z -=1;
$CURRENT_DOOR.setTransform(%x @ %y @ %z);
$CURRENT_DOOR.getDataBlock().locked = "0";
echo($CURRENT_DOOR.getTransform());
}strangely rather than moving 1 unit to the along the z it moves 100 units!?!?!
why is this?
#5
once i've sorted out the whole z -= 1 making the thing move by 100!!
04/29/2006 (10:22 am)
Oh just so you know what I'm tying to do. I'm gonna be using a schedule to get the object to move.once i've sorted out the whole z -= 1 making the thing move by 100!!
#6
04/29/2006 (12:20 pm)
It's possible to do that, though really not a good idea. Calling schedules to try and "animate" objects can end up crashing the engine if there's too much of it going on.
Torque Owner Magnus Blikstad