Game Development Community

Falling through ground

by Vasilios Hioureas · in Torque X 3D · 06/18/2009 (7:43 pm) · 22 replies

Im having a problem, when i move my character around, at some random points in the terrain, i end up falling through.

does anybody know what this might be caused from or how to fix it. or also, is there a way to find out the height of the terrain at the place which you are stepping so that i can do a:
if (myPosition < terrainPosition)
myPosition = terrainPosition+1;

or something.

thanks
Vas
Page «Previous 1 2
#1
06/25/2009 (1:40 pm)
Same thing just happened to me. I am working through John's book and implemented the player as described and the player fell through with the terrain that is created with the blank project.

I have never seen this happen in the FPS demo so I'm guessing that there is some difference in the way that the terrain and player are handled.

#2
06/25/2009 (3:08 pm)
What model are you using as the player? I haven't fully implemented the code in John's book because I'm heading down a space sim path, not fps (yet).
#3
06/26/2009 (5:04 am)
I'm just using the boombot which is really odd since there is no problem with the FPSDemo using the same robot.
#4
06/26/2009 (8:47 am)
I had the same problem. It looks to me like the character's collision shape is the problem. As previously mentioned the character in the FPS Demo which come with Torque workes fine, so use the collision shape stuff from the .txscene file:

<CollisionShape>
<Shape type="GarageGames.Torque.T3D.RigidCollision.CollisionSphereShape">
<Radius>0.65</Radius>
<Center>
<X>0.0</X>
<Y>-0.2</Y>
<Z>0.65</Z>
</Center>
</Shape>
</CollisionShape>

hope this works for you.
#5
07/02/2009 (3:43 pm)
Thanks for the suggestion, I tried changing the collision object but that did not fix the problem.

What I did find that fixed my problem was to replace the terrain with the one from the FPSDemo. I have not gone back through the xml to see what is different but apparently there is a difference.

Thanks,
John
#6
11/28/2009 (3:30 pm)
Having the same problem, even replace the XML with the XML from the fps demo, only difference was the position. hmmm

Anyway I am now thinking it must be the terrain itself. I used a terrain I made with TGE and still getting the same problem. Runs around and then while climbing a hill, slowly sinks into the ground. This is pretty frustrating.
#7
03/12/2010 (1:34 am)
it seems like you have to write your own functions for casting rays downwards to determine if you hit terrain. I hope that there is actually a built in way that it can be done correctly without having to do this.
#8
07/02/2010 (12:10 pm)
I'm experiencing this problem too. Would you be able to post the sample code for casting rays downwards?
#9
07/08/2010 (3:28 pm)
Actually, to be more precise, I experience this with objects I spawn...ie I create them as templates first, and then use the Clone() call to create copies of the templates as TorqueX objects. Those clones are the ones that fall through the terrain.
#10
07/09/2010 (8:30 pm)
After messing around quite extensively with TX3D I think this is where you have to look. In the FPS demo they create a class FPSPlayerControlComponent that inherits from T3DGroundControlComponent. If you work you way through the code, this is where they detect the ground and stop the player/object from dropping through.

While I am not going to say the book is wrong, I am going to say that it does get a character up on screen, moving about, but it's like the dark side Luke. A quickie shortcut version of what you should really do.

I am working on an example using the T3DGroundControlComponent and the T3DInputComponent. I have the feeling that will give the best results. It would really help if we had some documentation or examples outside of the FPS example code. If anyone else beats me to it please post your code and results.
#11
07/14/2010 (12:55 am)
Thanks. I'll try it.
#12
07/17/2010 (12:49 am)
I tried adding this T3DGroundControlComponent to my objects yet they still fall through the terrain...
#13
07/17/2010 (7:23 pm)
I have it working, however I still have camera issues as well as some other bits I do not understand. I will share my code as soon as I remove the licensed models animations etc.

Derrick are you using the adam pack? I will leave the code for that if you are, you can place in the animations and models.
#14
07/18/2010 (6:46 pm)
Yes...I am using Adam pack too.

How did you get it to work? Did you make your non-player character class a sub-class of T3DGroundControlComponent, or did you implement all that ray tracing stuff they had in the FPS demo?
#15
07/18/2010 (7:39 pm)
OK i have uploaded my demo game files for you to check out. smokinskull.com/Game.zip

How does it work? I do not know completely. I am still figuring out what they are doing in some places.

I will tell you that in order to use the adam pack you need to figure out what the cam is. Its a node in the DTS named cam, however it seems that EVERY DTS from GG has a different XYZ transform on the cam. I also tried eye etc, they have different transforms as well. I imagine you can fix this in FPSCamera I just have not figured out how yet.

Another terribly interesting bit is that the torque_orc has less poly's than boom bot yet using him as a player greatly reduces the framerate.

If you swap the boombot for the orc, you will also need to swap the animations. Otherwise you get an assert as the orc has a different number of nodes than the boombot.

#16
07/18/2010 (8:45 pm)
@Derrick in order to get the transforms right I made a change in _UpdateTransform in the CameraComponent, the one that has FPSCamera.

For Adam to work:
protected override void _UpdateTransform()
{
    Vector3 rotation = RotationOffset;
    rotation.X = (_lookHeight.Value - 0.5f) * -(float)Math.PI;
    rotation.X += -1.5708f;
    RotationOffset = rotation;

    base._UpdateTransform();
}
For Torque Orc:
{
    Vector3 rotation = RotationOffset;
    rotation.X = (_lookHeight.Value - 0.5f) * -(float)Math.PI;
    rotation.Z = -1.5708f;
    RotationOffset = rotation;

    base._UpdateTransform();
}
Boombot
{
    Vector3 rotation = RotationOffset;
    rotation.X = (_lookHeight.Value - 0.5f) * -(float)Math.PI;
    RotationOffset = rotation;

    base._UpdateTransform();
}

Like I said this is all derived/stolen from the example FPS code.


#17
07/22/2010 (6:14 am)
OK the new 3.1.5 final has cased some part of my code to break. The player shoots straight up in the air and then falls to the ground, stopping just above the ground level floating in a falling state.

I'll figure this out yet.

#18
07/25/2010 (1:52 am)
Yeah...I tried switching back to creating new instances of objects instead of spawning from Torque templates but the objects still fall through the ground.

I'm starting to suspect the falling through ground thing is a bug in Torque X 3D...
#19
08/14/2010 (12:25 am)
What is the bare minimum set of components a TorqueObject needs to stand on a terrain?
#20
08/15/2010 (2:35 am)
Hmmm....I figured it out...it appears that when one generates clones of objects using the example in the book where
TorqueObject newObj = templateObject.Clone()

the T3DRigidComponent is not copied over correctly.

I generated my other objects the same way I generate the player object and everything is fine now. :)
Page «Previous 1 2