Game Development Community

Testing to see if a collision would occur if you moved a object

by Philip Loyer · in Torque X 2D · 03/20/2008 (6:45 pm) · 5 replies

Hi Guys and Gals, I am trying to figure out a way to test to see if I moved my T2DSceneObject to a specified place to see if a collision would occur there and if it would to not move it. One problem I have is it could be any sort of random objects that it could bump into. Any ideas would be greatly appreciated. thanks!


Phil

#1
03/20/2008 (9:01 pm)
Ever get that feeling when you get so close to the answer you've been looking for, however it eludes your grasp? Well thats where I am now.

I have found this which I think will work for my purposes.

GarageGames.Torque.T2D.T2DSceneGraph.Instance.FindObjects()

Which does a radial search. The problem you might ask? Well for some reason unbenownst to me is for some reason my T2DSceneGraph object reference does not have a Instance property. Could someone please shed some light on this subject? It's starting to drive me more bonkers than I already am.

Thanks a ton!

Phil
#2
03/20/2008 (10:48 pm)
In Torque X 2.0, multiple scene graphs are now supported so there is no longer a T2DSceneGraph.Instance. Instead, you can start with your T2DSceneObject and access its scenegraph through its SceneGraph property. From there you can call FindObjects.
#3
03/20/2008 (11:06 pm)
Could I get a code example? I still seem to be have some trouble here, I cannot find the FindObjects method at the root of the SceneGraph property. Any Suggestions?

Thanks for the help. Phil
#4
03/20/2008 (11:14 pm)
Sorry, I missed a detail ... you need to go through Container as well. Here's an example:

T2DSceneObject myObject = TorqueObjectDatabase.Instance.FindObject<T2DSceneObject>("MyObject");
myObject.SceneGraph.Container.FindObjects etc.
#5
03/20/2008 (11:23 pm)
Thanks man, I really appreciate it =) Now I get to figure out this SceneQueryData thing lol

Phil