Clone(true) bugs?
by Alex Rice · in Torque Game Builder · 10/05/2006 (10:06 pm) · 3 replies
Is anyone having erratic results with the t2dSceneObject::clone(true) member? I haven't got a recipe to duplicate this problem. It is probably a bug in my code. But I suspect clone(true) is returning corrupted sprites sometimes.
I have a FSM that I am iterating with onTimer() callbacks. One of my states calls clone(true) to spawn baddies. It works fine, they cloned sprites appear for a few times but after a while they on't appear on screen.
According to dump() info, I think they should be appearing on screen, but they are not. Here is a example mystery sprite that was created by clone(true). Wouldn't you expect it to appear on screen based on the following info? I ran setPosition("0 0") and setLayer("0") but still don't see this sprite. I even tried removing and adding back into the scenegraph. Any suggestions
==>2716.dump();
Member Fields:
AngularVelocity = "0"
animationName = "eggPROTOcell_redSolidAnim"
AutoMassInertia = "1"
AutoMountRotation = "0"
AutoRotation = "0"
BlendColor = "1 1 1 1"
BlendingEnabled = "1"
canSaveDynamicFields = "1"
class = "MLEggsSolidEgg"
CollisionActiveReceive = "0"
CollisionActiveSend = "1"
CollisionCallback = "0"
CollisionCircleScale = "1"
CollisionCircleSuperscribed = "1"
CollisionDetectionMode = "FULL"
CollisionGroups = "-1"
CollisionLayers = "65536"
CollisionMaxIterations = "1"
CollisionPhysicsReceive = "0"
CollisionPhysicsSend = "0"
CollisionPolyList = "0.074 -0.937 0.320 -0.852 0.540 -0.609 0.802 0.194 0.707 0.628 0.106 0.984 -0.518 0.616 -0.660 0.222 -0.395 -0.622 -0.169 -0.877"
CollisionPolyScale = "1.000 1.000"
CollisionResponseMode = "CLAMP"
config = ""
ConstantForce = "0.000 0.000"
ConstantForceGravitic = "0"
Damping = "0"
Density = "0.01"
DstBlendFactor = "ONE_MINUS_SRC_ALPHA"
Enabled = "1"
FlipX = "0"
FlipY = "0"
ForceScale = "1"
ForwardOnly = "0"
Friction = "0.3"
GraphGroup = "0"
Immovable = "0"
Inertia = "1.69165"
Layer = "0"
Lifetime = "0"
LinearVelocity = "0.000 0.000"
LinkPoints = ""
Mass = "0.313609"
MaxAngularVelocity = "10000"
MaxLinearVelocity = "10000"
MinAngularVelocity = "0"
MinLinearVelocity = "0"
MountForce = "0"
MountInheritAttributes = "1"
MountOffset = "0.000 0.000"
MountOwned = "1"
MountRotation = "0"
MountTrackRotation = "1"
Paused = "0"
Position = "0.000 0.000"
Restitution = "1"
Rotation = "0"
scenegraph = "2597"
size = "8.000 8.000"
SortPoint = "0.000 0.000"
SrcBlendFactor = "SRC_ALPHA"
superclass = "MLEggsEgg"
UseMouseEvents = "0"
Visible = "1"
WorldLimitCallback = "0"
WorldLimitMax = "0.000 0.000"
WorldLimitMin = "0.000 0.000"
WorldLimitMode = "OFF"
Tagged Fields:
eggColor = "red"
I have a FSM that I am iterating with onTimer() callbacks. One of my states calls clone(true) to spawn baddies. It works fine, they cloned sprites appear for a few times but after a while they on't appear on screen.
According to dump() info, I think they should be appearing on screen, but they are not. Here is a example mystery sprite that was created by clone(true). Wouldn't you expect it to appear on screen based on the following info? I ran setPosition("0 0") and setLayer("0") but still don't see this sprite. I even tried removing and adding back into the scenegraph. Any suggestions
==>2716.dump();
Member Fields:
AngularVelocity = "0"
animationName = "eggPROTOcell_redSolidAnim"
AutoMassInertia = "1"
AutoMountRotation = "0"
AutoRotation = "0"
BlendColor = "1 1 1 1"
BlendingEnabled = "1"
canSaveDynamicFields = "1"
class = "MLEggsSolidEgg"
CollisionActiveReceive = "0"
CollisionActiveSend = "1"
CollisionCallback = "0"
CollisionCircleScale = "1"
CollisionCircleSuperscribed = "1"
CollisionDetectionMode = "FULL"
CollisionGroups = "-1"
CollisionLayers = "65536"
CollisionMaxIterations = "1"
CollisionPhysicsReceive = "0"
CollisionPhysicsSend = "0"
CollisionPolyList = "0.074 -0.937 0.320 -0.852 0.540 -0.609 0.802 0.194 0.707 0.628 0.106 0.984 -0.518 0.616 -0.660 0.222 -0.395 -0.622 -0.169 -0.877"
CollisionPolyScale = "1.000 1.000"
CollisionResponseMode = "CLAMP"
config = ""
ConstantForce = "0.000 0.000"
ConstantForceGravitic = "0"
Damping = "0"
Density = "0.01"
DstBlendFactor = "ONE_MINUS_SRC_ALPHA"
Enabled = "1"
FlipX = "0"
FlipY = "0"
ForceScale = "1"
ForwardOnly = "0"
Friction = "0.3"
GraphGroup = "0"
Immovable = "0"
Inertia = "1.69165"
Layer = "0"
Lifetime = "0"
LinearVelocity = "0.000 0.000"
LinkPoints = ""
Mass = "0.313609"
MaxAngularVelocity = "10000"
MaxLinearVelocity = "10000"
MinAngularVelocity = "0"
MinLinearVelocity = "0"
MountForce = "0"
MountInheritAttributes = "1"
MountOffset = "0.000 0.000"
MountOwned = "1"
MountRotation = "0"
MountTrackRotation = "1"
Paused = "0"
Position = "0.000 0.000"
Restitution = "1"
Rotation = "0"
scenegraph = "2597"
size = "8.000 8.000"
SortPoint = "0.000 0.000"
SrcBlendFactor = "SRC_ALPHA"
superclass = "MLEggsEgg"
UseMouseEvents = "0"
Visible = "1"
WorldLimitCallback = "0"
WorldLimitMax = "0.000 0.000"
WorldLimitMin = "0.000 0.000"
WorldLimitMode = "OFF"
Tagged Fields:
eggColor = "red"
About the author
#2
10/05/2006 (10:37 pm)
Thanks for confirming Tom. I changed my code to instead of clone(true) do new t2dAnimatedSprite() and my game is running fine now. I suspect a tricky bug in clone() somewhere.
#3
10/05/2006 (10:52 pm)
I also have seen some issues with clone(), but also have not been able to track them down. I'm pretty sure it's on the bug list (will confirm tomorrow), but without a reproduction case it's very difficult to track down.
Associate Tom Eastman (Eastbeast314)
Perhaps something similar is going on, though you seem to have an ObjectID.