Game Development Community

Shooter - use of mount()

by Benjamin LIU · in Torque Game Builder · 08/19/2006 (8:33 am) · 3 replies

Hey guys, I am using the v1.1.1 Game Builder
I would ask some question about the mount(%object, %offsetX, %offsetY)
I have read the doc, but I found the %offsetX, %offsetY are working like 10 times the pixel I have given
e.g. mount( %this, -5, -5 ); will result like mount( %this, -50, -50 );

below is my code:
function playerShip::createJet( %this ){
   %jetEff = new t2dParticleEffect() 
   {
      scenegraph = %this.scenegraph; 
   };
   
   %jetEff.loadEffect("~/data/particles/customFire.eff");
   %jetEff.setEffectLifeMode("INFINTE");
   %jetEff.mount( %this, -5, -5 );   
   %jetEff.setMountInheritAttributes( true );
   %jetEff.playEffect();   
}

I have scale down the pShip size to half ( form 32x16 to 16x8 ),
it shouldn't get anything to do with this problem right?

any idea?
can someone help, please!


by the way, could those addLinkPoint(%offsetX, %offsetY) and mount(..) functions work better if togather.
just want to know more way to mount... ^^;
thanks

#1
08/19/2006 (8:52 am)
Benjamin,

If you haven't already, have a look at the "TGB Reference.pdf", it explains all the function calls and details about this parameters.

In this case you should look at the "mount()" call, specifically the "%offsetX" and "%offsetY" parameters and you'll see that it mentions that they are in "object-space". There's definately not in pixel-units. You should see the meaning of "object-space" in the glossary at the end of that document.

Essentially though, "-1" is the left (or top) of your object and "+1" is the right (or bottom) of your object. Object-space is used because if you change the size of the object, the mount positions will be relatively the same.

Hope this helps,

- Melv.
#2
08/19/2006 (9:10 am)
Thanks Melv. It did help ^^, and make me fully understand.

I see the point now, sorry I did read it through, but just overlook the glossary part.
I should have checked the glossary first and less trouble will come across, thanks.

ben
#3
08/19/2006 (1:33 pm)
No trouble Benjamin, just thought I'd point you to the reference guide as well as it's extremely useful.

- Melv.