Mounted image doesn't appear
by Robert Norris · in Torque Game Engine · 07/18/2005 (2:16 am) · 3 replies
Hi,
i've tried to find a simple example, how to mount an image to another object. The fact is, that i've read much about mounting weapons here in the forum, but none of these examples work. I can see the player model, but the mounted image doesn't appear, except in the Show Tool Pro ;)
For testing i use the tutorial.base. I've inserted my player model, written a ShapeBaseDataImage for the weapon i want to mount to the player and used the mountImage(ShapeBaseImageData, Slot) method. But the weapon doesn't appear.
Can someone give me a link or a complete minimal example for mounting images including all necessary components/code? I don't need an example especially for weapons, i only want to see that weapon mounted to my playermodel.
Thanks a lot.
Rob
i've tried to find a simple example, how to mount an image to another object. The fact is, that i've read much about mounting weapons here in the forum, but none of these examples work. I can see the player model, but the mounted image doesn't appear, except in the Show Tool Pro ;)
For testing i use the tutorial.base. I've inserted my player model, written a ShapeBaseDataImage for the weapon i want to mount to the player and used the mountImage(ShapeBaseImageData, Slot) method. But the weapon doesn't appear.
Can someone give me a link or a complete minimal example for mounting images including all necessary components/code? I don't need an example especially for weapons, i only want to see that weapon mounted to my playermodel.
Thanks a lot.
Rob
About the author
#2
I've inserted an output (echo) in the onAdd-Method to be sure that the engine calls the method. It does. But there appears no mounted weapon.
My weapon model has several mount points. One of them is called "mountPoint". I think this should be the point where the weapon is mounted to the player object? The player model has also several mount points. One is called "mount0". Here should the weapon appear, right?
I can't see an error in my code, but i must find it ;)
07/18/2005 (5:08 am)
Thank you for your answer. I've done the mounting in the way you describe it, but it doesn't work. I don't know why. I've inserted an output (echo) in the onAdd-Method to be sure that the engine calls the method. It does. But there appears no mounted weapon.
My weapon model has several mount points. One of them is called "mountPoint". I think this should be the point where the weapon is mounted to the player object? The player model has also several mount points. One is called "mount0". Here should the weapon appear, right?
I can't see an error in my code, but i must find it ;)
#3
I've derived my own Player-Class from Vehicle and overwrote the mountImage()-method. Instead of calling the Parent::mountImage() method, i returned true as a dummy entry :D
Now it works, thank you!
07/18/2005 (5:45 am)
I've found it!I've derived my own Player-Class from Vehicle and overwrote the mountImage()-method. Instead of calling the Parent::mountImage() method, i returned true as a dummy entry :D
Now it works, thank you!
Torque Owner Greg Gardinier
Now, when you want to mount an object in TGE you need to define what point you are mounting to twice. Once in the image and again in the actual call to mount the image.
Your weapons image should have somthing like this in it:
Make sure that your "mountPoint" is equal to whatever point you want to use on your model in this case its 0.
To actualy mount the object to the player you can use a command like this (Where "AssaultRifleImage" is your image name") :
Note the 0 this needs to be the same number that you used in the image. Now, I just inserted this command into player.cs like this:
//---------------------------------------------------------------------------- // Armor Datablock methods //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- function Armor::onAdd(%this,%obj) { %obj.mountImage(AssaultRifleImage, 0); //Here it is // Vehicle timeout %obj.mountVehicle = true; // Default dynamic armor stats %obj.setRechargeRate(%this.rechargeRate); %obj.setRepairRate(0); } function Armor::onRemove(%this, %obj) { if (%obj.client.player == %obj) %obj.client.player = 0; } function Armor::onNewDataBlock(%this,%obj) { }Hope that helps. :)