Game Development Community

ShapeBase drived object not rendering until moved

by JohnT · in Torque Game Engine · 05/22/2006 (8:47 am) · 3 replies

Hope someone can point me in the right direction.

I have created a new vehicle type that is based upon the BraveTree Tank. I've stripped out everything that I did not need and am able to bring my object into the game(except I can't see it). My problem is that the object does not render until I move it ever so slightly in the editor. Then it snaps into view and works perfectly.

I read in the forums where someone else was having this problem but he never got it resolved, hope someone else has experienced this and can help.

Thanks,
John

#1
05/22/2006 (6:10 pm)
At a guess I'd assume it's most likely because the base shapebase classes don't correctly set the object's initial transform.

If you're adding the vehicle via script, just use the setTransform method on it after it's created. For example:

// Create your desired vehicle transform here (using the identity by default).
%transform = "0 0 0 1 0 0 0";

// Create the vehicle.
%vehicle = new WhateverVehicle()
{
    datablock = WhateverVehicleData;
};

// Set the vehicle transform to ensure it appears where it should.
%vehicle.setTransform(%transform);

// Ensure the vehicle is cleaned up with the mission.
MissionCleanup.add(%vehicle);

// If the vehicle has a client, ensure it's always scoped to that client.
if (%client)
{
    %vehicle.scopeToClient(%client);
}
#2
05/23/2006 (5:22 am)
@Daniel,

Thanks for the above snippet of code.

the ScopeToClient helped fix a problem I was having with networked clients. Now the vehicle is transmitted to the client but is still unfortunately invisible still. What is really odd is that I can make the player attach to the vehicle but he vanishes from the game and is rendered with the vehicle in a completely empty world except for particle effects.

I think I've found where Ork's go when they die ;)
#3
05/23/2006 (12:16 pm)
Finally got it!!!

As usual I messed up the packupdates and the object was rendering below the terrain from what I can tell. Now that I fixed the position transform, everything works.

It