Game Development Community

I think dynamic create animation and mounting it. Can do this?

by Chen Chao · in Torque Game Builder · 09/10/2007 (1:55 am) · 3 replies

%bug= new t2dAnimatedSprite()
{
sceneGraph = %this;
class = "Bug";
layer = 1;
size = "77 95";
animationName = "bug_Animation";
canSaveDynamicFields = "1";
MountOffset = "0.620 -0.021";
MountOwned = "1";
MountInheritAttributes = "0";
mountID = "6";
mountToID = "4";
};

%bug.playAnimation("bug_Animation");

I want it to mount the tree.Can do this?

#1
09/10/2007 (9:32 am)
I would first create the object, then mount it using "mountTo", If the object you want to mount it to has an ID of 4, then what you typed will work (maybe), but the next time you run your game it will not have the same object ID.
#2
09/10/2007 (6:55 pm)
Thanks James :)
but i have the other qusition.
method:
mount(t2dSceneObject object,[float offsetX=0],[float offsetY=0],[float mountForce=0],[bool trackRotation?=true],[bool sendToMount?=true],[bool ownedByMount?=true],[bool inheritAttributes?=true])

need offsetX and offsetY

but method onMouseDown(%this, %modifier, %worldPosition, %mouseClicks) only provides worldPosition
How do I translate this position?
#3
09/11/2007 (8:59 am)
Can you explain a bit more what you are trying to do? How is the mouse involved?
But, I think this might answer your question:

A world position turned into object space:
%sceneObject.getLocalPoint( worldx, worldy);

An object position turned into world space:
%sceneObject.getWorldPoint( localx, localy );