Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Physics plug-in powered by PhysX

Author
Message
FERSIS
17
Years of Service
User Offline
Joined: 17th May 2006
Location:
Posted: 28th Mar 2011 23:19
Ive tried both C++ 'standard math functions' and DarkGDK's
No dice.
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 28th Mar 2011 23:34
Oh yeah, I made an error in my testing code, I will take another look.

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th Mar 2011 00:59
OK, this should work, what threw me off was that I forgot that you can't use the turn, pitch and roll commands for this to work.

You need to use dbRotateCamera() when changing angles, if you need to turn and pitch for any reason you will need to use the other method, although you can do it with matrices I think.



FERSIS
17
Years of Service
User Offline
Joined: 17th May 2006
Location:
Posted: 29th Mar 2011 02:25
Youre the king of kings my good man.
Thanks for all the help.

If you need any help with anything just tell me. I owe you.
Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 29th Mar 2011 14:17
Hey Matty, can we implement ragdolls with your plugin?

hi
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th Mar 2011 14:25
Not this one, but you can in the new one coming soon. It only works if the models limbs are set up right for dbPro/GDK. You can probably get any model working though if you set it up in a modelling program.

iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 30th Mar 2011 20:18
I've tried googling, but I haven't been able to figure out why one would use a CharacterController. Right now I'm moving my objects using setPosition() and setOrientation() and applyForce/applyLocalForce(). Can you point me to an article or something?

Thanks,

Flamesilver
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 30th Mar 2011 20:51
There is no ideal way to simulate a character using dynamic actors and forces.

A character controller will go up steps and slopes, the height and steepness of what it can climb is determined by you, it will also always stay upright which is pretty important. You get the twitch control over your character which dynamic actors do not give you.

Although I would suggest that is you find you do not need a controller then don't use one. If you have a system that is working then stick with it. If you find at any point your character is acting strange or upsetting the simulation in any way then try the controller and see if it improves things for you.

iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 31st Mar 2011 03:52
Thanks for the info. Since I'm simulating a zero-g environment, everything can just behave, lol.

One more thing: Is there any way to set up groups where objects can pass through certain objects but collide with others? Basically, friendly fire - bullets need to pass through teammates, but hit enemies and neutral targets.


Thanks,

Flamesilver
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 31st Mar 2011 19:31
Yeah, take a look at:


Make 4 groups:
1 Good guys
2 Bad guys
3 Good guy bullets
4 Bad guy bullets

Set groups 1 and 3 to false.
Set groups 2 and 4 to false.

That should work I would think.

One thing you should know is that I have not implemented CCD(continuous collision detection) so if your ships are too small and your bullets are too fast you may end up with not every bullet registering a collsion.

I presume its working fine so far but thought I would let you know that you will need to work within certain limits.

iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 31st Mar 2011 21:33
Awesome, thanks!

And I was wondering about the CCD thing. Great that you answered it for me. So basically if the bullet can travel the whole width of a ship in one tick then it wouldn't hit? I'm gonna have to do a bit of back-ray casting.

I still haven't looked too deeply into collision models yet. I'm currently working on the game engine itself and how all the software parts work (forms, collections, actions, and states). UML diagram is going up as we speak.
iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 1st Apr 2011 17:47
I'm looking now into actual collision handling beyond the physics part. I'll be writing a CollisionHandler class that pretty much does this:



My question is about logic and timings. When I getContactActorA/B(), it's the same until I getContactData() again, correct? But the position of the objects - has it already updated to new physics positions by the time? Does that mean a single object could've got into 2 collisions by the time we call that?

So, should I do collision handling stuff on the same tick? Or on the next loop iteration? i.e. if a bullet collides with a ship, bullet explodes immediately - I will explode it on the same tick. But because it doesn't terminate immediately, it could've hit one ship, bounce to the second ship and hit that too. Is it possible that I would end up processing the 2nd collision of the bullet before the first on that loop I described above (as per how a stack works, I believe it's last in first out)?

Let me know what you think.

Thanks,

Flamesilver
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 1st Apr 2011 23:19
Quote: " When I getContactActorA/B(), it's the same until I getContactData() again"


Not sure if you misunderstand what is happening, although your code looks correct.

You put getContactData() in a while loop and then every game loop this will iterate through all contacts since the last loop, this could be one contact or one hundred contacts, whatever.

As long as you empty the contact list by waiting until getContactData() returns 0, then you can be sure you have dealt with all collisions for that loop.

You should find that you don't get any problems with things happening in the wrong order or anything like that.

Let me know if I have not really answered your question

iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 2nd Apr 2011 07:03
I guess after thinking about it, my question is this:

What if in 1 loop of dbSync() (so.. 1 tick), a bullet hits a ship, bounces, and hits another ship?

After the first collision, the bullet should be destroyed (a call to its die() class), but in the Physics simulation, would it still hit another ship if they're right next to each other? Is the chances of that happening like, nil?
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 2nd Apr 2011 13:22
In theory that might be possible but I really doubt that will ever happen.
Each time you simulate, the physics does actually simulate around 4 timesteps I think, so what you say may be possible but like you say its highly unlikely.

Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 18th Apr 2011 21:13
Could this be turned in to a full-on plugin for DBPro?

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 18th Apr 2011 21:44
Quote: "Could this be turned in to a full-on plugin for DBPro?"


It could but its alot of work.

I am currently writing a more professional version with alot more functionality, it's a complete rewrite and alot of things are handled better.

I will probably sell it though, it will be available for GDK/DBPro if I ever finish it

[href = http://forum.thegamecreators.com/?m=forum_view&t=184148&b=8][/href]
WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 19th Apr 2011 04:12
I like the reviews Fulcrum has been getting all over the forums. It is a shame it's just for GDK.

Hope you don't mind but I've decided to use Fulcrum in my next SGE.

There's no completed or fully operational GUI system so I'm sticking with WinApi. I was hoping that I could find a complete working GUI so I could run the SGE in full screen.

Some of the physics features make my next project more interesting cos I'll be adding all kinds and the interface will have a complete revamp using a layering system for scenes, sounds, textures, objects, etc.

Warning! May contain Nuts!
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 19th Apr 2011 15:30
Quote: "Hope you don't mind but I've decided to use Fulcrum in my next SGE."


Great news, look forward to seeing what you come up with.

Quote: "There's no completed or fully operational GUI system so I'm sticking with WinApi. I was hoping that I could find a complete working GUI so I could run the SGE in full screen."


Have you looked at CEGUI? I'm pretty sure it has everything you would need for this kind of project.

Quote: "It is a shame it's just for GDK."

I know, if I was not working on an improved PhysX plugin I would probably port it over.

WLGfx
16
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 20th Apr 2011 01:06 Edited at: 20th Apr 2011 02:22
I'm hoping it will be easy enough to implement things like gusts of wind or magnetic areas or any other ideas I come up with using the system. Any other ideas, let me know. Makes automation of a level much easier.

For the time being I'm going to stick with winapi for the gui. I can have pop-up dialogs for the editing and just attach a menu to the main GDK window.

I might leave the wheel controllers out for the time being from my plans. They confused me a little. But I do need some ideas on implementing different types of controllers.

EDIT: I'm getting a linker error with 'PhysXCooking.lib'. Any ideas? It doesn't even seem to be part of the PhysX SDK for some reason.

Warning! May contain Nuts!
iulian
12
Years of Service
User Offline
Joined: 28th May 2011
Location:
Posted: 28th May 2011 19:57
Hi,

I am new here and I don't know too much about Dark GDK and PhysX. I've made a map in 3D World Studio and loaded into Dark GDK. I use PhysX for phyiscs. I made a controller, it moves, works fine, but I want to jump, how can I do that?
Can anybody show me how to make a very simple jump using PhysX? I use gravity.
I was thinking that I should move the object (my controller is a box) up if the space key is pressed and the object touch the ground, but I don't know how to check if a object is on the ground.

Thank you very much!

PS: Sorry for my English!

Iulian
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 28th May 2011 22:43 Edited at: 28th May 2011 22:44
Hi iulian,

If you use the character controller the way I do then you are always pushing the controller down into the ground to simulate gravity?

If so, you could have:


This is not tested, it is one of many ways you can handle jumping, hope this helps

iulian
12
Years of Service
User Offline
Joined: 28th May 2011
Location:
Posted: 28th May 2011 23:57 Edited at: 29th May 2011 00:01
It works, but if I keep pressed the space key it's a problem, it jumps continuous.
The gravity push the controller down.
I hope you understand what I mean.
I'm thinking how to do that only if the controller touch the ground.

Thank you!

Iulian
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 29th May 2011 00:08 Edited at: 29th May 2011 01:51
Would you be willing to provide the source code for this plugin so that it can be used with other languages as well?

I'm also assuming that the static library limits this plugin to linking only with the Visual C++ 2008 compiler?

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th May 2011 11:21 Edited at: 29th May 2011 11:22
Quote: "It works, but if I keep pressed the space key it's a problem, it jumps continuous. "


I thought you might say that

Key press latency is a more general problem that you will come accross alot, there are different ways to address this but I think for this situation a quick raycast straight down would be a better solution.



Raycast from the position of the character, straight down(0, -1, 0), if it hits then you know you can jump, you will also need this command:




Quote: "Would you be willing to provide the source code for this plugin so that it can be used with other languages as well?"


Probably yes, let me know exactly what you have in mind, if you can email me then we can discuss it.

Quote: "I'm also assuming that the static library limits this plugin to linking only with the Visual C++ 2008 compiler?"


I would not think so, I would assume it would link to with any compiler, although I might be wrong. I think it would need access the VC++ 2008 runtimes but that should not be an issue. My knowledge in this area is not great so any input from anyone who knows would be welcomed.

iulian
12
Years of Service
User Offline
Joined: 28th May 2011
Location:
Posted: 29th May 2011 15:11 Edited at: 29th May 2011 18:18
I used raycast now, and I can check if the controller touch something. If it does, it can jump. It works fine, but there's another problem. When I press space, the controller jump, but it goes up and the it falls down. You can't see how it goes up. The controller it's like teleported up there and then falls. I'm sorry, I don't know how to explain.
I have tried to use setLinearVelocity() but the game crashes. I can't use setLinearVelocity() to controller. I don't know how to make it looks like it jumps, not only change the position and the fall down using gravity. There should be a speed for jump.

I hope you will understand what I mean. I really don't know how to explain. My English is limited.

Iulian
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th May 2011 20:37
You can't use the commands for dynamic actors on controllers, all controller movement is handled by you.

I never tested that code I give you but it still looks like it should work, you may just need to play with the values:
5 and 0.95 in my example.

iulian
12
Years of Service
User Offline
Joined: 28th May 2011
Location:
Posted: 29th May 2011 23:00
The code works, but I want the jump to be more smooth, more gentle. I'll make a video soon.

Iulian
Mr Bigglesworth
16
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 30th May 2011 02:58
Great job on Fulcrum

I am getting a problem when I compile my project, I am using PhysX SDK 2.8.4, here is the error



I am not sure what is causing this, the only thing I think it could be is that I have a later version of the SDK. I will try using the 2.8.3 version of the SDK when I get home, but I am stumped with this error
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 30th May 2011 12:24
Quote: "I am getting a problem when I compile my project, I am using PhysX SDK 2.8.4, here is the error"


I think you will have to use 2.8.3, I will need to change the docs to make sure people use this version, when I wrote them I was not sure if other versions would work.

Mr Bigglesworth
16
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 30th May 2011 19:31
Well, I can't seem to find a download for 2.8.3 anymore on the developer website, there is only downloads for 2.8.4 and 3.0
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 30th May 2011 21:31
I can't believe how hard it is to find things on their developers site, I can't find it

I have attached the SDK, if I'm right I have provided the dll's with the Fulcrum downlod.

Attachments

Login to view attachments
Mr Bigglesworth
16
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 30th May 2011 23:48
Thanks man

Works great now.

Login to post a reply

Server time is: 2024-04-25 15:59:39
Your offset time is: 2024-04-25 15:59:39