Game Development Community

Problem attaching a light to a player

by JohnT · in Torque Game Engine · 04/24/2006 (5:20 pm) · 26 replies

@ John K.,

This is a continuation of a thread that was started in the public forum and is now being moved here.

The problem that I am seeing is if a light is attached to a player, the clients that connect after the server side player is created will not see that player but yet it exists and can be collided with even though it cannot be seen and the light is not visible.

Also, this same behavior can be seen if a StaticShapeData object is created and mounted to the player. Instead of the player disappearing, the StaticShapeData object disappears just as the player did above.

The code that I am using to test this problem for the first scenario is by adding the following to the Crossbow.cs script to mount a light to mount0.

Thanks for the help!
John

function CrossbowImage::onMount(%this,%obj,%slot)
{
// Images assume a false ammo state on load. We need to
// set the state according to the current inventory.
if (%obj.getInventory(%this.ammo))
%obj.setImageAmmo(%slot,true);

%light = new volumeLight() {
dataBlock = "sgMountLight";
rotation = "-0.357694 0.933839 9.9834e-009 180";
scale = "1 1 1";
dataBlock = "sgMountLight";
Enable = "1";
IconSize = "1";
ParticleColorAttenuation = "1";
Texture = "common/lighting/lightFalloffMono.png";
lpDistance = "0.35";
ShootDistance = "5";
Xextent = "0.6";
Yextent = "0.6";
SubdivideU = "4";
SubdivideV = "4";
FootColour = "1.000000 1.000000 1.000000 0.182000";
TailColour = "0.000000 0.000000 0.000000 0.000000";
};
%light.attachtoobject(%obj);
}
Page«First 1 2 Next»
#21
02/24/2007 (6:37 am)
John, just checking to see if there is any progress in this area. I am closing in on completing my project and really need to implement a flashlight. I am still seeing the same problem with the light not appearing to new players joining the game, only players that were already in game in multiplayer can see a light turned on but all new players do not see the light beams that already exist in game.

Also, I have converted my project over to TGE 1.5 but am still having this same problem as in 1.4.2.

Sure hope your still looking into this one....
#22
02/24/2007 (6:51 am)
I actually reported this half a year ago and figured it got fixed later. The fix is for TGEA but I'm sure it'll work on TGE 1.5 as well. I'll see if I can shake up the code later next week. Email me if I forget.
#23
02/26/2007 (10:43 am)
I thought I merged those changes back into TGE 1.5, if not then I did it right after the release and it should be available next code drop. TSE had several code drops over the past few months while ramping up to 1.0, so it's hard to pinpoint when the fix was made.
#24
02/27/2007 (10:35 am)
John - do you remember where in TSE the change was made to fix the problem? If so, I can try and bring over the changes to TGE. I have already made soo many changes to TGE 1.5 for my project that I would prefer not to have to merge them with the next version.
#25
03/02/2007 (1:25 pm)
The changes would definitely be in both sgLightObject and fxLight.
#26
03/03/2007 (12:00 pm)
Thanks John!
I found a couple of things in sgLightObject.cc that appear to have fixed the problem.
Finally, Torque can make flashlights again! :)

added sgAttachedObjectGhostIndex = -1; before if(!sgAttachedObjectPtr.isNull()) in sgCalculateParticleSystemInfo()

and
changed the following method to...
bool sgLightObject::onNewDataBlock(GameBaseData *dptr)
{
sgLightObjectData *newdb = dynamic_cast(dptr);

if(!newdb || !Parent::onNewDataBlock(dptr))
return false;

mDataBlock = newdb;
return true;
}
Page«First 1 2 Next»