Game Development Community

Strange graphical anomalies? [resolved]

by Cosmic Logic · in Torque X 2D · 07/10/2009 (2:23 pm) · 5 replies

Hey,

This would be too hard to explain with words so here are some pictures of what's going on.


If I stand here with my character:

Everything looks fine. The camera is mounted to the black oval at the character's feet.


But when I move to here:
The stands and, depending on where I'm standing, some of the chairs and purple guys dissapear.


Once I move to here on the corner, everything goes back to normal.

It only happens when I walk around the top corners of the arena.

Does anyone have any idea what might cause this?

The purple guys are animated clones. I clone them in the onRegister of a behavior on the seats that clones it, positions it based off the angle of the seat and (when I get around to making more aliens) picks a random alien to put there. If that makes any difference.

#1
07/10/2009 (2:52 pm)
Could it be the number of objects? Having too many objects for the camera depth can often make backgrounds disappear.

By default, the standard camera can only have a maximum of 100 objects on screen at-a-time.
***EDIT*** This limit is the default, but can be changed.

Are the electric fence entities objects, or just part of a fixed background?

Looks pretty cool, anyway.
#2
07/10/2009 (3:03 pm)
The code Scott was talking about.

Try this in your game.cs

T2DSceneCamera cam = TorqueObjectDatabase.Instance.FindObject<T2DSceneCamera>("Camera");
cam.FarDistance = 10000.0f;
#3
07/10/2009 (4:43 pm)
Oh, I see. For a second I thought Torque would only ever let you use 100.
I'll play with far distance and see what I can come up with :)

I just deleted the back row of seats and limited the number of spectators and it worked fine. I'll try using that fardistance variable and see if I can get some more in.

GG should almost pay you to work these forums Scott :D
A thank you to David as well.
#4
07/10/2009 (5:27 pm)
Too much time on my hands, and strangely enough I get a kick out of debugging code. Must have a masochistic side in me:)

***EDIT***
Naturally, in the code to get the camera, the string name can be skipped if there is only going to be one camera in use at the time.

A comment in the T2DSceneGraph._SetupProjection() code explains why the camera's FarDistance needs to be set to a number greater than the number of objects that will be on screen at-a-time.
// the far distance needs to be greater than the total number of objects on screen at once  
// since each object is assigned a depth value based on it's sort order in the scene
#5
07/12/2009 (11:18 am)
Added a link to this thread on the TX2D Community Links.

Perhaps a thread could be pinned to the top to remind people to check there first before starting a new thread to see if it has already been addressed. I don't know who can pin threads, though.