Mount questions
by Pablo Alonso · in Torque Game Builder · 03/02/2005 (5:21 pm) · 9 replies
When I mount an fxStaticSprite2D 'A' on another 'B' and set the mountForce to 0 so they move toghether, but when I move B with setLinearVelocityX, A starts to get a little behind, it's just a couple of pixels, but it does sepparate from A, maybe it's because I keep changing setLinearVelocityX because I want to acomplish an accelerated movement. So anyways, my question is if there's any way I can them to move toghether with mount? because right now I discarded the mount function and am using setLinearVelocityX on both objects, so they move side by side.
Another mount questions, when I mount an object how can I rotate it?
And last question... but not a mount question... is there any way to move the pivot point of a fxStaticSprite2D? or does it always rotates from the center of the image?
Thanks a lot
Another mount questions, when I mount an object how can I rotate it?
And last question... but not a mount question... is there any way to move the pivot point of a fxStaticSprite2D? or does it always rotates from the center of the image?
Thanks a lot
About the author
#2
About the rotation imagine an arm and a torso, you want the arm to rotate when the torso rotates but it also should rotate by itself, that's what I don't know how to acomplish, how can I rotate just the arm, setRotation doesn't work after mount is used.
Thanks
03/02/2005 (5:36 pm)
Yeah, my problem is that even when I set the mountForce to 0 they don't move exactly the same, they have a couple pixels of difference.About the rotation imagine an arm and a torso, you want the arm to rotate when the torso rotates but it also should rotate by itself, that's what I don't know how to acomplish, how can I rotate just the arm, setRotation doesn't work after mount is used.
Thanks
#3
Also, I set sendToMount to false (on an object with mountForce of 20), but the object appeared at the mount instantly, so this might also be a bug.
03/02/2005 (9:11 pm)
Pablo is correct. I think this is a bug. I mounted an object with 0 mountForce and there is a noticeable lag.Also, I set sendToMount to false (on an object with mountForce of 20), but the object appeared at the mount instantly, so this might also be a bug.
#4
Setting trackRotation? to false allows you to still control the rotation yourself as usual. The default is true though so the object tracks the parents rotation so it looks rigidly mounted.
Quick Search reveals: Pivot-Points. :)
@Jason: I'll check that but it has been used several times in the demos so I'm very suprised by this. If so, I'll let you know.
Thanks for the heads-up guys.
- Melv.
03/03/2005 (12:38 am)
@Pablo: With a mount-force of zero (special case of rigid-mount), no matter what you do to the parent, the object should stay mounted at the exact position. I'll check this myself to confirm and let you know if there is in-fact a bug.Setting trackRotation? to false allows you to still control the rotation yourself as usual. The default is true though so the object tracks the parents rotation so it looks rigidly mounted.
Quick Search reveals: Pivot-Points. :)
@Jason: I'll check that but it has been used several times in the demos so I'm very suprised by this. If so, I'll let you know.
Thanks for the heads-up guys.
- Melv.
#5
I use the brick image and you can see clearly a 2 or so pixel difference between the two
thanks
03/03/2005 (3:00 am)
Here's an example just replace the end of client/client.cs with:// ************************************************************************
//
// Add your custom code here...
//
// ************************************************************************
createPlayer();
createCompanion();
}
function createPlayer ()
{
datablock fxImageMapDatablock2D(playershipImageMap)
{
mode = full;
textureName = "~/client/images/brick";
};
$player = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
$player.setPosition("-50 25");
$player.setSize( "10 10" );
$player.setImageMap( playershipImageMap );
schedule(2000, 0, "playerAccelerateRight");
}
function playerAccelerateRight()
{
%xVel = $player.getLinearVelocityX();
if(%xVel < 30)
{
schedule(30, 0, "playerAccelerateRight");
%xVel ++;
$player.setLinearVelocityX( %xVel );
}
}
function createCompanion ()
{
datablock fxImageMapDatablock2D(cannonImageMap)
{
mode = full;
textureName = "~/client/images/brick";
};
$companion = new fxStaticSprite2D() { scenegraph = t2dSceneGraph; };
$companion.setSize( "10 10" );
$companion.setImageMap( cannonImageMap );
$companion.setAutoRotation(10);
$companion.mount($player, "0 -2", 0);
}I use the brick image and you can see clearly a 2 or so pixel difference between the two
thanks
#6
@Melv: I'm probably doing something wrong to cause the object to appear instantly at the mount point. But I do know that the rigid mounting seems to be not so rigid.
03/03/2005 (11:26 am)
@Robert: Maybe you already saw this thread about that very subject? :)@Melv: I'm probably doing something wrong to cause the object to appear instantly at the mount point. But I do know that the rigid mounting seems to be not so rigid.
#7
I have fixed this problem. It will be included in the next update.
Thanks for the report.
- Melv.
03/30/2005 (9:10 am)
FYII have fixed this problem. It will be included in the next update.
Thanks for the report.
- Melv.
#8
03/30/2005 (10:10 am)
Aha so I wasnt' just seeing things :)
Associate Anthony Rosenbaum