Game Development Community

PhysX 3.x Plugin

by Timmy01 · in Torque 3D Professional · 10/28/2013 (5:11 am) · 500 replies

Update:
If you wish to follow this than please check here github.com/ChrisCalef/Torque3D/tree/physx3_advanced_WIP
#281
06/04/2014 (5:37 pm)
Or maybe PhysicsShapeBase? If it's indeed a hybrid of ShapeBase and GameBase/Physics
#282
06/04/2014 (6:09 pm)
At the moment i have just called it PhysicsShapeEx (Extended). Maybe it's a little confusing so i'll have a think about it. I have also removed the trigger stuff from the original PhysicsShape and moved it over to PhysicsShapeEx and also removed the activateTriggers field, with the Extended physics shape it's permanently turned on.
#283
06/04/2014 (6:16 pm)
PhysicsShapeEx sounds good.

Can't wait to try this out, awesome :)
#284
06/04/2014 (6:31 pm)
Honestly, given the history and intent behind:
www.garagegames.com/community/resources/view/5495
Doubt anyone would complain if that was updated to suit, so long as backwards compatibility was maintained.

I know I wouldn't
#285
06/04/2014 (8:39 pm)
Ok pushed this through to the repo.

The new class name is PhysicsShapeEx. The original PhysicsShape remains exactly as it was previously (no triggers etc). The main difference between the two is PhysicsShapeEx derives from ShapeBase whereas PhysicsShape is from GameBase. If you don't need the extra stuff from ShapeBase than stick to the original PhysicsShape.

I have done little testing on this new class and it in fact contains no new code at all,i only made it derive from ShapeBase. So just report any problems. I gotta say, i'm still not 100% sold on calling it PhysicsShapeEx, i'll have a think about that one.
#286
06/04/2014 (9:35 pm)
Wow, awesome!

So I've added it in, and successfully changed all my PhysicsShape objects to PhysicsShapeEx. Everything shows up and works just as before including triggers :)

So, wanting to test the onCollision stuff, and am not having any luck. Must be missing something.

I have a datablock PhysicsShapeExData(PhysX_BouncingBoulder)

And a call to it in the mission file:

new PhysicsShapeEx() {
playAmbient = "0";
dataBlock = "PhysX_BouncingBoulder";


I see it fine, and can roll it along with the machine gun.


So I then try this:


function PhysX_BouncingBoulder::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
echo("PHYSX BOULDER HAS COLLIDED WITH AN OBJECT!");


But when I roll the ball into a TSStatic Wall or drop it on myself I do not see the echo in the console.

Any ideas what I'm doing wrong?

Thanks!
P
#287
06/04/2014 (10:13 pm)
No you are not doing anything wrong, currently it will only work when other objects hit the PhysicsShapeEx, i gotta implement the rest of the collision stuff properly, it's missing a fair bit actually. I wouldn't bother with it actually till i fix a few more things up.
#288
06/04/2014 (10:19 pm)
Ahh Ok no problem :)

I did notice that I got an echo or two when playing around, must have been when collisions were going the other way.

Looking good though - I can report that the new PhysicsShapeEx class seems to be working perfectly just like the regular PhysicsShape class... I've just removed all PhysicsShapes and replaced them with the Ex and everything is working as it should.
#289
06/04/2014 (10:21 pm)
Actually just having a good look over the RigidShape class, i think i should rename the PhyscisShapeEx to RigidPhysicsShape and implement a lot of stuff the RigidShape (well stuff that will work with the physics engine anyway). I think that gives everyone a better idea of what the class is designed to do.

Don't too much with it, i'll experiment with it all over the weekend and see what i can come up with.
#290
06/04/2014 (10:28 pm)
Yeah RigidPhysicsShape works... Because there was already onCollision in there and stuff that we're looking for.
#291
06/04/2014 (10:37 pm)
I think I will revert todays changes & create a testing branch for all this just so it doesn't interfere with the physx3 branch. Ill merge it all over onced its been tested and names are settled ;-)
#292
06/05/2014 (2:05 am)
I removed the PhysicsShapeEx from the physx3 branch so everything in that branch is back to normal.

I have created a new testing branch github.com/rextimmy/Torque3D/tree/testing. I'll use this to test out new stuff and once i'm satisfied it has been tested and working ok i'll than merge it over to the more stable physx3 branch.

Paul just switch over to that branch and i'll let you know about the new class when i get a chance to add it in.
#293
06/05/2014 (6:33 pm)
@Paul:

I won't get a chance to fix any of this up till next week sometime, so i have updated the testing branch with RigidPhysicsShape which is just exactly what PhysicsShapeEx was before. I have to redo that whole class but i'll try to keep all the naming the same so you should be safe to use it for now and not have to rename anything at a later date. The triggers work ok but the rest obviously have to be fixed up.
#294
06/05/2014 (6:39 pm)
OK cool, sounds good, thanks!
#295
06/06/2014 (1:04 am)
Over the weekend i'm going to clean up the physx3_basic branch and do a pull request and hopefully get that branch into the main repo. Physx 2.8 is dead and physics side of T3D needs updating.
#296
06/06/2014 (8:08 pm)
Ok physx3_basic pull request is here:github.com/GarageGames/Torque3D/pull/685

Project manager pull request is here: github.com/GarageGames/Torque3D-ProjectManager/pull/27
#297
06/07/2014 (7:09 am)
Great job Timmy :)

Now T3D will finally have a working physics solution that is up-to-date and better than ever... most have steered clear in the past from using physx builds in Torque games as far as I have seen, mostly because it posed so many problems with collisions and such, so hopefully this much better plugin will turn more people on to the possibilities.

Been doing a lot of testing, happy to report it's all working fantastic!

Can't wait for the on collision stuff :) I noticed now with the new shapes being based off shape base I already can trap on damage events and also assign shape names so they have labels above them in game... way cool :)

Cheers
P
#298
06/07/2014 (8:54 am)
I'd like to second that, Thank you! Just so you know a lot of people are very grateful for the work you've put into this.
#299
06/07/2014 (8:58 am)
Just wanted to let you know the physX plugin works on osx as well. Thank you for all of your work Timmy.
#300
06/07/2014 (6:53 pm)
Thanks guys, Andrew and Lukas also produced some nice additions for the plugin too.

@Jeff: Did you ever overcome that problem in your game?