Moving Platform Collision Detection
by Jason Davis · in Torque Game Engine · 05/23/2006 (3:31 pm) · 138 replies
Okay, I've searched the forums to no avail. I have a dts object scripted to move upward when the player steps onto it (via a scripted trigger.) The dts object is a simple cube. Even though the player detects the collision mesh when stepping onto the cube and the cube begins to visibally rise, the player continues to stand where the old collision mesh was. I have tried everything I know to do... anyone have any help or resources they can give me? Thank you so much and I will look forward to a response.
#2
Rigidshapes also detect collision.
This has been a big gripe of mine for some time. Unfortunatley i'm not skilled enough to do the programming to enable collision checking on other objects.
How is the object moving up? is it done via animation? if so... are you animating the collision mesh itself in the movement?
05/23/2006 (4:21 pm)
Only player and vehicles do collision checks. And best of all they only do so IF they are moving.Rigidshapes also detect collision.
This has been a big gripe of mine for some time. Unfortunatley i'm not skilled enough to do the programming to enable collision checking on other objects.
How is the object moving up? is it done via animation? if so... are you animating the collision mesh itself in the movement?
#3
Here's the video I mentioned . . .
www.rustycode.com/matt/pathshape1.wmv
For more information, check out this thread . . .
www.garagegames.com/mg/forums/result.thread.php?qt=25328
05/23/2006 (4:30 pm)
Hi guys,Here's the video I mentioned . . .
www.rustycode.com/matt/pathshape1.wmv
For more information, check out this thread . . .
www.garagegames.com/mg/forums/result.thread.php?qt=25328
#5
Quote from Matt who made the videos......
However this resource may be able to do all that and then some.
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9093
05/23/2006 (4:43 pm)
Quote:It is not in the 1.4 release nor will it be in any of the 1.4.x releases. It is however one of the *highest* priority improvements to the engine for the next version and we put some pretty significant research and development into this while working on Marble Blast Ultra. However, I have to finish Constructor before I can circle back on this.
Quote from Matt who made the videos......
Quote:
This code is not available at the moment, and might not be for awhile :(
However this resource may be able to do all that and then some.
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9093
#6
Too bad about the delay on Matt's fix.
But I've got to say, thanks for posting the link to Anthony's resource. It looks very promising.
05/23/2006 (5:06 pm)
Ramen,Too bad about the delay on Matt's fix.
But I've got to say, thanks for posting the link to Anthony's resource. It looks very promising.
#7
Yes, I am animating the collision mesh. I guess this is just something that TGE does not support yet. The object moving upward is kind of like an elevator. There must be some way of creating an elevator sequence within the stock TGE. If I could figure out a way to make the player continuously check for collisions (even when standing still)??? I don't know... If you guys have any more suggestions I am all ears! Thank you so much!!!
- Jason
05/24/2006 (2:22 pm)
Aaron and Ramen, appreciate the comments and suggestions.Quote:How is the object moving up? is it done via animation? if so... are you animating the collision mesh itself in the movement?
Yes, I am animating the collision mesh. I guess this is just something that TGE does not support yet. The object moving upward is kind of like an elevator. There must be some way of creating an elevator sequence within the stock TGE. If I could figure out a way to make the player continuously check for collisions (even when standing still)??? I don't know... If you guys have any more suggestions I am all ears! Thank you so much!!!
- Jason
#8
05/24/2006 (2:34 pm)
One more thing I just thought about... what about turning the elevator into a player or AIplayer object and disabling gravity? I'll try messing around with this tonight. Please let me know about any more suggestions. This is a feature I want to add to my sandbox. Thanks!
#9
I remember reading something along those lines a while back, but I couldn't find any threads on it when I looked yesterday.
One cheesy hack might be to teleport the player in the Z axis (I think) in really small increments until a pre-determined limit is reached. One benefit is that you could accomplish it in script only.
Basically, you could use some variation of the following script elements . . .
Stick that in a 'for' loop until some criteria is met or trigger is tripped and it should work. And, it should be network aware -- but not particularly bandwidth friendly. :(
I'm sure there are better ways to do this, but this is how I would try it. For anyone else reading this, please forgive the ugly hackishness of the approach.
:)
Aaron E.
05/24/2006 (2:48 pm)
Jason,I remember reading something along those lines a while back, but I couldn't find any threads on it when I looked yesterday.
One cheesy hack might be to teleport the player in the Z axis (I think) in really small increments until a pre-determined limit is reached. One benefit is that you could accomplish it in script only.
Basically, you could use some variation of the following script elements . . .
%myPlatformLoc = %myplatform.getPosition(); %player.setTransform(%myPlatformLoc);
Stick that in a 'for' loop until some criteria is met or trigger is tripped and it should work. And, it should be network aware -- but not particularly bandwidth friendly. :(
I'm sure there are better ways to do this, but this is how I would try it. For anyone else reading this, please forgive the ugly hackishness of the approach.
:)
Aaron E.
#10
Thanks,
Jason
05/24/2006 (3:13 pm)
Aaron, thanks for the suggestion. I will definitely try that tonight. Any thing else come to mind, let me know please. I read your profile... are you into Spiritually rich games? Just curious.Thanks,
Jason
#11
05/24/2006 (3:21 pm)
A for loop would run all the code in a single game loop, giving you a net result of moving directly from point a to b. Hacking it with schedules would be really ugly and lack interpolation, so it's not even worth it. Moving any kind of collision on objects won't accomplish anything... the stock physics and collision code simply isn't made to update things like that. Maybe use grav shafts in the meantime, you can use physical zones for that XP. If you do any hack implemenations, keep them simple and minimal, as they're not something youl'd want to keep. The interior stuff will be the best way for this eventually, as if you've played Marble Blast you know such code already has been done in TGE (it has all kinds of moving interiors).
#12
I've had good results with %player.setTransform for teleportation-type movements and have even attached minor incremental translations and rotations to key binds without any problems. That works fine, except it requires repeated key presses to get anywhere.
There must be a way to automate the process with minor position increments. I've been trying to figure it out . . . without luck though.
However, I'm definitely looking forward to using the moving interiors code. Someday.
05/24/2006 (5:20 pm)
Ah . . . It looks like my scripting/coding deficiencies are showing up again. I've had good results with %player.setTransform for teleportation-type movements and have even attached minor incremental translations and rotations to key binds without any problems. That works fine, except it requires repeated key presses to get anywhere.
There must be a way to automate the process with minor position increments. I've been trying to figure it out . . . without luck though.
However, I'm definitely looking forward to using the moving interiors code. Someday.
#13
it's as simple as doing
You will probably want to use something like pathshape instead of just an animation.
%platform.attachchild(%player);
the player's position will be updated as the platform moves.
I've verified this works in a way. i attached a player object to an and was spinning it around with my gamepad and the player followed along just fine.
05/24/2006 (5:29 pm)
Seriously. look into that resource i posted a link to. that should do exactly what you want.it's as simple as doing
You will probably want to use something like pathshape instead of just an animation.
%platform.attachchild(%player);
the player's position will be updated as the platform moves.
I've verified this works in a way. i attached a player object to an and was spinning it around with my gamepad and the player followed along just fine.
#14
I don't think I understand the question, but I'll e-mail you about it -- I'm not sure everyone will be interested in my views on the subject.
:)
05/24/2006 (5:33 pm)
Jason,I don't think I understand the question, but I'll e-mail you about it -- I'm not sure everyone will be interested in my views on the subject.
:)
#15
05/24/2006 (5:38 pm)
That's a pretty major core engine change though, and I imagine player physics are still not going to work properly with the position update linked. You can get that much just mounting a player to a pathshape, without all those source changes. I wouldn't do that much code modification just for a hack fix.
#16
After tinkering with Anthony's sceneObject changes in an 'experimental' version of my app, it looks pretty cool. I haven't tried it on a network yet or anything serious, but I'll try to give it a decent workout tomorrow. :)
Thanks again for posting the link.
05/24/2006 (6:02 pm)
Ramen,After tinkering with Anthony's sceneObject changes in an 'experimental' version of my app, it looks pretty cool. I haven't tried it on a network yet or anything serious, but I'll try to give it a decent workout tomorrow. :)
Thanks again for posting the link.
#17
Thanks for posting that link. I used Aaron's suggestion and hacked a way to move the platform with the player on it via a trigger, but it does look jerky... but it works! Now, about the link: I do not have a way to compile the source of the engine. I have always used djgpp, lcc-win32, Dev-CPP, etc. to compile C++ code... but I am told that this does not work for compiling TGE. Any suggestions? I don't want to spend an arm and a leg for visual studio.
05/27/2006 (11:46 am)
Ramen,Thanks for posting that link. I used Aaron's suggestion and hacked a way to move the platform with the player on it via a trigger, but it does look jerky... but it works! Now, about the link: I do not have a way to compile the source of the engine. I have always used djgpp, lcc-win32, Dev-CPP, etc. to compile C++ code... but I am told that this does not work for compiling TGE. Any suggestions? I don't want to spend an arm and a leg for visual studio.
#18
I think there is a free version of the Microsoft Visual C++ compiler that you can use. I haven't tried it myself, though. Here's a link describing it with a link to the compiler . . .
www.garagegames.com/mg/forums/result.thread.php?qt=17744
Another option is the fairly cheap (but not free) Visual C++ .Net Deluxe Learning Edition Book/IDE/Compiler combo. Here's a link . . .
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5288
Wow. I just saw your e-mail in my in-box.
I hope this helps,
Aaron E.
05/27/2006 (12:08 pm)
Jason, I think there is a free version of the Microsoft Visual C++ compiler that you can use. I haven't tried it myself, though. Here's a link describing it with a link to the compiler . . .
www.garagegames.com/mg/forums/result.thread.php?qt=17744
Another option is the fairly cheap (but not free) Visual C++ .Net Deluxe Learning Edition Book/IDE/Compiler combo. Here's a link . . .
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5288
Wow. I just saw your e-mail in my in-box.
I hope this helps,
Aaron E.
#19
You can also use the free express edition of visual c++:
msdn.microsoft.com/vstudio/express/default.aspx
I think there's even a tutorial on the tdn on how to compile torque with it.
05/27/2006 (12:23 pm)
Jason,You can also use the free express edition of visual c++:
msdn.microsoft.com/vstudio/express/default.aspx
I think there's even a tutorial on the tdn on how to compile torque with it.
#20
Another good one! Here's a link to that TDN article . . .
tdn.garagegames.com/wiki/Torque/vs2k5
It looks pretty cool.
[Edit: rearranged things]
05/27/2006 (12:39 pm)
Stefan,Another good one! Here's a link to that TDN article . . .
tdn.garagegames.com/wiki/Torque/vs2k5
It looks pretty cool.
[Edit: rearranged things]
Torque Owner Aaron E
Default Studio Name
You might want to look into pathed interiors or moving interiors. Matt Fairfax did some work with this a couple of years ago, but I don't know what became of it. There were even some videos of it in action. It looked very cool. :)