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
#141
03/05/2014 (5:29 pm)
@Andrew

In regards to the code being clean enough for the main repo:

The only thing that may be is my triangle mesh code that supports multiple PxMaterials that I have yet to submit. ( Sorry, been busy :( )

It is kind of a hack to be honest, basically for each material inside of the shape, it creates a separate triangle mesh for it (material indices wouldn't work, so we took this approach which works fantastic)

It does change a few classes outside of the physx3 plugin however. Will this be a potential problem Andrew? My only suggestion for it is to maybe have another *ugh* #define for like #define PHYSX3_MATERIALS or something, so it won't break people's code.
#142
03/05/2014 (6:30 pm)
Torque based vehicle interacting with physics objects

#143
03/05/2014 (6:45 pm)
Awesome work there Timmy, looks awesome!
#144
03/05/2014 (8:15 pm)
@Jeff H

I'm sure we can rework it so it won't have any impact on existing projects. It should also work through the physics plugin system so it would be possible for someone to fill in the blanks on the bullet side and it should just work. That's how I tried to make cloth and the goal for particles as well.

I'm thinking we could create a Physics section of material configuration and they otherwise behave no differently. Then again I haven't seen the changes yet :P

@ Timmy

That looks like a lot of fun. We should probably put together some kind of demo that combines it all. Have you tried driving the car through cloth yet?
#145
03/05/2014 (8:25 pm)
@andrew:

Still chasing down a few problems with it.

At the moment with cuda enabled:

It actually rips the cloth of the beam and sometimes crashes with:
CuSolver.cpp (450) : unknown error : CUDA error: CUDA_ERROR_LAUNCH_FAILED

Disabling Cuda and it works pretty good, spits out a few of these warnings though:
ScClothSim.cpp (361) : warning : Dropping collision convex due to 32 plane limit
#146
03/05/2014 (8:58 pm)
Repo Update:
*Added moveKinematicTo function to PhysicsBody.
*Added kinematic support to StaticShape.

With the StaticShape i added another boolean field called kinematic which is disabled by default. If you have a StaticShape or anything derived from static shape and you know that it will be moved during a scene (i don't mean in the editor) than set kinematic to true, otherwise i would recommend leaving it disabled. With kinematic enabled it will collide with rigid bodies but at this stage it will not collide with static shapes.

No vehicles yet, still working on some problems.

#147
03/06/2014 (8:25 am)
Wow... You guys continue to amaze...

So I go to bed with Pathshapes not working, and wake up to a fix - and it works great!

My player now sticks nicely to the pathshape when it moves and I don't fall off.

Only thing is, the pathshape is terribly jittery - this is new with 3.0 T3D and above I think, it used to work fine in 1.1. There was a thread or two about this issue, but it never seemed to get traction - Since you guys were just in there getting this working, any ideas on how to stop the jitters?

Anyhow, thanks again for this, one more thing checked off my list...

Regarding the vehicles - I can mount the existing Torque vehicles fine if I use a keyboard shortcut, just the collision wasn't working. I see you have them colliding with shapes now which is awesome, look forward to that fix too!

Cheers
P
#148
03/06/2014 (8:31 am)
Quote:ScClothSim.cpp (361) : warning : Dropping collision convex due to 32 plane limit

I know where this one is coming from I think:

Quote: Support for convex collision added to 3x clothing solver (only a total of 32 planes per clothing actor is supported).

Right now I took the easy way out and enabled collision detection for all objects on every piece of cloth using a COLLIDE_ALL flag or something to that extent. They want you to enable collision for each cloth on a per-object basis so it reduces the amount of collision checks. What I'll have to do is rig up something similar to how torque's collision works now. When you step into range of the cloth (within it's bounding box most likely) it'll enable collision between the cloth and the object.
#149
03/06/2014 (2:15 pm)
@Paul:
I'll release the vehicle stuff today, it's actually a fairly minor thing to get working, pretty much along the same lines as the static shape in that it just needed a physics representation. I haven't noticed the jitter problem, if i get a chance i will take a look although i can't promise anything as i have a few other things that need fixing for now too.

@Andrew:
Aah ok, yeah that makes perfect sense.


#150
03/06/2014 (2:42 pm)
hi can i be contacted ? i work with your plugin and i have yet to understand how to enable the ccd as the command console does not work (or do i need to do them in demos ??).
#151
03/06/2014 (3:13 pm)
@Henares:
Quote:
PhysicsShape datablock there is a ccdEnabled field. If you are creating a PhysicsBody by any other means there is a PhysicsBody::BF_CCD flag that can be used. It can only be enabled on non static actors.

I really must finish the wiki, so this kind of thing is documented properly.
#152
03/06/2014 (4:03 pm)
Repo update time again:
*Added physics representation for vehicles.

Like the static shape stuff i have added a datablock field enablePhysicsRep to the vehicle class which is enabled by default. As usual just report any problems you come across, i have only tested the cheetah with it at this stage.
#153
03/06/2014 (4:13 pm)
Wow thanks @Timmy this really looks nice :),
especially now vehicles.
#154
03/06/2014 (4:14 pm)
Woohoo! Going to try it out now, thanks!

BTW, regarding pathshape... I notice your repo does not have it included, was wondering if you could add in the code you have, just in case what I have is not right?

That way I can try it out and see - I'm merging your stuff into our custom code base, maybe if I started over with a fresh working copy I would be better off...

If you can, that would be great, thanks much again.

Cheers
P
#155
03/06/2014 (4:23 pm)
Next on the list, i have to bring bullet and physx2 plugin up to speed with some of the changes, i'll upgrade bullet to version 2.82 too while i'm at it.

@Paul:
Is the repo missing something? It's just a direct fork from T3D 3.5 development branch.

Oh does anyone here have a cuda capable NVidia card? If so would you mind testing the physx samples from here github.com/andr3wmac/Torque3D-PhysX-Samples and run "level 3: Cloth Shape" and see it crashes when the player or anything really collides with any of the hanging cloth.
#156
03/06/2014 (4:24 pm)
ok i understand this, but in practical, how do i make the character shape use the ccd : its the part i am not sure about ! (trough the sripting i mean) or maybe you tweaked player cpp already for this use ?
#157
03/06/2014 (4:35 pm)
ok here is the problem, i mixed the terms CCD with the abreviation of Character Controller...
#158
03/06/2014 (4:49 pm)
The player doesn't have CCD enabled for it but it actually can. I have not actually tested how well the kinematic stuff goes in physx3 with ccd enabled, i'll have to test it out one day and perhaps add an option to enable it.
#159
03/06/2014 (5:04 pm)
@Timmy: The PathShape resource is not part of the main T3D code, it's an add-on... So it's not in their repo. I just figured since you said you had tested it, that meant that you had the resource added in to your dev code? If so, I was just wondering if you could add that to the PhysX repo so I could grab it and try for myself :)
#160
03/06/2014 (5:10 pm)
Oh i have never tested it, i have only tested the StaticShape and just assumed anything deriving from that class would work ok ;-)