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 / Havok Physics Plugin

Author
Message
binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 29th May 2010 00:27 Edited at: 29th May 2010 22:27
Havok Physics v1.0.0


Here is my physics plugin that I just started. I thought I would release it for you guys. This plugin is powered by Havok Physics.


It currently does not have all of the features that Havok has, but it is really coming along. It comes with full documentation of what is implemented so far, a header file, a lib and a demo!

Rotation have been fixed! Download has been reposted on this post.

Current Features:

Core Havok functions
Rigid Bodies
Rigid Body property commands
Character Controllers
Visual Debugger

What is comming:
Raycasting
Multithreading
Vehicles
Ragdolls



In the screenshot, i am simulating over 2000 objects all at once, and i am getting a framerate of 37. Oh yeah and thats only single threaded and with a cpu usage of 50-60% before starting the demo.

The download is attached below. It is pretty big, comming in a 20mbs compressed. The actualy lib its self is 140mb. Havok is a very very big library, and there is nothing i can do to decrease the size of it.[center][/center]

Attachments

Login to view attachments
binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 29th May 2010 00:31 Edited at: 29th May 2010 18:16
Here is a link for just the demo. Rotation are a bit messed up, but they should be fixed shortly.

v1.0.0

Attachments

Login to view attachments
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th May 2010 01:00 Edited at: 29th May 2010 01:01
Thats cool, we're giving these guys lots of options for physics/collision, a Havok plug-in will be great.

I'm pretty sure that your rotations are not correct, a few cubes were standing on a corner while I'm pretty sure they are not doing that in the simulation, or they shouldn't be. I have not downloaded the whole thing, does it have some kind of visual aid to see what the simulation is doing?
I struggled lots with the rotations and I still have not found a solution I'm completely happy with, do you update the object matrix directly, or do you use dbRotateObject() to apply the rotations extracted from the actors via their matrix or quaternion or do you do something different?

Sorry for all the questions but I think I might be able to help.

binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 29th May 2010 01:06
Yeah i dont think my rotation are right either. Sometimes i have objects rotating through the surfaces. Havok does come with a visual debugger but i havnt set it up yet. Basically im extrating the rotation from the physics engine as a quaternion, then using a function to convert that to euler angles. Then i use those angles and use dbRotateObject().
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th May 2010 01:24
OK cool, where did you get your quaternion to Euler function from?
The problem with finding a function that does this is that there are lots of different standards for euler rotations, anyway Pauli came to my rescue with this function, I'm pretty sure he won't mind me sharing as it is up somewhere in another post also.




This should work for you, although I don't think its perfect, but I will go into that another time if needed as Pauli does not have any problems with it and you might not either.

binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 29th May 2010 05:15 Edited at: 29th May 2010 06:25
Lol thats the exact same function in using. I actually used the one pauli posted. I think the problem then might be the physics engine. Ill have to get the debugger working and take a look.

Alright, so i got the debugger working and everything looks fine in it. There arnt any rotation problems in the debugger, so i know its not the physics engine. It must be the quat to euler function im using or something. Also i noticed darkgdk returns 0.01 off for an objects size. For ex if i do dbMakeObjectBox(1,5,5,5), darkgdk will return for its size 4.99,4.99,4.99. Could this possibly be the problem. I wouldnt think so though.
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th May 2010 13:09
I would say that the GDK floating point inaccuracies are not your problem, I would guess that Havok may use a different rotation system to PhysX and ODE. Try looking into whether it uses right or left handed co-ordinate system and then check ODE or PhysX using google.
I may be completely wrong as I too struggle with all the rotaion stuff, sorry.

_Pauli_
AGK Developer
14
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 29th May 2010 13:53 Edited at: 29th May 2010 13:55
Hey, that's nice - another option for physics simulation!
Wow, people will have some great solutions at hand in the future and that's just awesome! (By the way: screw the 50€ DarkPhyiscs )
It gives very satisfying results working on something like this, right?
Good luck with it!

Quote: "I'm pretty sure he won't mind me sharing"


No, I'm glad I can help others.

Quote: "as Pauli does not have any problems with it"


Yes. I don't know the exact reason why, but I didn't have any problems when using this function with ODE.
I don't see anything ODE-specific in it, so I just don't get what could cause issues with other Physics systems.
Somebody may need to read about quaternions and stuff.

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 29th May 2010 17:49 Edited at: 29th May 2010 18:01
Alright guys, im gonna do some massive research today and post on the havok forums to try and figure out whats going on. There may be a possibility that im not setting up my rigid bodies right, but im pretty sure i am. I send Xarshi a email and asked him to take a look at them. Ill get back once i figure out weather havok is right handed or left handed. I found out that physx is right-handed. I also believe that ODE is left-handed or least when converting from ODE to directx, which is the case.

My post:

http://software.intel.com/en-us/forums/showthread.php?t=74689
_Pauli_
AGK Developer
14
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 29th May 2010 17:58 Edited at: 29th May 2010 17:58
Quote: "I also believe that ODE is left-handed"


ODE isn't left or right handled. You decide what coordinate system to use. ODE doesn't care about the axis' directions since the labels (x, y, z) can be exchanged as you like.
That may be the case in other physics systems too. Don't know...

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 29th May 2010 17:59
Ahhh ok sorry then.
binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 29th May 2010 18:15 Edited at: 29th May 2010 18:21
The rotation problem has been fixed. It was a very silly error.

Instead of:

I had:

New version of the demo will be reposted on the second post. The visual debugger has been added.
N3wton
15
Years of Service
User Offline
Joined: 3rd Jun 2009
Location: Leeds, UK
Posted: 30th May 2010 14:46 Edited at: 30th May 2010 14:48
When i use havok in my GDK games, to convert from quat i used a built in havok command...



Note: M_PI is in the math defines, you can just use 3.14159 if you dont want to include the maths. also I times by RadToDeg as the havok command returns in radians, whereas the GDK takes degrees

that gets the eurluar angle...

just thought i'd say if it shrinks code... tho i don't know which way is quicker

Nice work on a lib tho, I usually just link all the raw havok, but if you make this good, I'll deffo use it

Good Luck

Yours
N3wton

Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 30th May 2010 15:23
Trying out now!

binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 31st May 2010 04:09 Edited at: 31st May 2010 04:17
Also guys, when you try and compile you may get about 800 linker warning about missing pdbs. Im not really sure how to get rid of these warning without just using the pdbs.

Also i have decided that version 1.0.1 will include raycasting and multithreading. I am going to save vehicles until the summer, and when finals are over.
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 31st May 2010 13:18
Glad to see you got the rotations fixed, this was one of the hardest things I needed to do, until Pauli posted that function that is. Sorry about the right-left handed advice, its just that there are more than 20 variations of the quatToEuler function depending on what you are using(left handed, right handed, z-up, y-up etc), its a bit of a nightmare .

The other hard thing to do is setting up terain or a complex object, if you have any problems I'm sure me or Pauli will be able to help.

Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 31st May 2010 14:32
It works kinda slow, sorry for saying, altough Havok Physiscs is pretty good, but this wrap up works a bit slow, getting 30 fps on my system. Ideas? My computer is midrange.

But good one anyway. I am gonna check out further how to work with it.

binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 31st May 2010 18:37 Edited at: 31st May 2010 18:46
With the 30 fps, how many objects are you simulating red eye? Idk why it would be slow, it was a very simple wrap and there was nothing super complex to really slow it down. The only thing i could think of is im using the havok debug libs. Maybe switching to the release ones will speed it up. Also @matty, thanks but i got complex objects all up and running.

UPDATE:
Well, i got multithreading working and thats all setup, it will be in the next release. Next is raycasting. This is very simple and i should be able to get it done in 1 hour including documentation and code plus an example. You guys can expect v 1.0.1 soon. Also the new version will include the release lib, and not the debug lib which it currently has.
Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 31st May 2010 21:02 Edited at: 31st May 2010 21:03
Yup , release (compiled) ones gave me high fps.

And it was ur demo btw. Good Wrap, keep it up.

binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 31st May 2010 21:19
hahahahah! no wonder why you were only running at 30 fps! The demo has over 2500 rigid bodies being simulated all at once! Thats pushing havok to its max. Version 1.0.1 will be using the release libs of havok.
Red Eye
15
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 2nd Jun 2010 10:16
But when I compiled the demo, but with release mode on, it gave me 120 fps.

Might gonna use this havok physics plugin. Looks great!

But if u gonna use release libs i am sure it will get better.

binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 11th Jun 2010 01:15
Yeah, it should be even faster once i compile my lib with the havok release libs. Ive been really busy with finishing up school lately, so i havnt had any time to work on this. Once its summer ill have tons of time and ill try and get this finished. More testers are happily appreciated!

Login to post a reply

Server time is: 2024-07-04 11:06:08
Your offset time is: 2024-07-04 11:06:08