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 / ODE character controller demo and gravity help!

Author
Message
binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 15th Feb 2010 22:15
Hey guys, I've been doing a lot with ODE lately and it really is awesome. I just got done finishing up my wrapper for ODE. I thought id post a little demo of a character controller i made. Also for all of those ODE people out there that could help me with gravity i would be happy. My problem is that objects fall veryy slow! If you notice in the demo, when you fall off the building you fall down very slow!Im running at 60fps and with a gravity or -9.81. Is there something else that could be making everything fall so slow!! Also im using these values for my damping.

dWorldSetLinearDamping(World, 0.001);
dWorldSetAngularDamping(World, 0.005);

Download for demo is attatched below!

Attachments

Login to view attachments
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 16th Feb 2010 08:52 Edited at: 16th Feb 2010 08:54
huh? not just that the fall is slow, when you fall you can move and go through the wall, well i dunno what ODE is, but im pretty sure you can do better stuff without using any physics engine

binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 16th Feb 2010 13:05
Yea, as you can see there are still some kinks in it. One of such is the gravity problem, and the other is collision wwith .dbo files. Sometimes it acts weird, while it works perfectly with .x files. Pauli, if you are seeing this, I'm using your method u posted on the forums for trimesh.
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 16th Feb 2010 22:41
Ok, the fall speed problem could have something to do with how you do dWorldStep / dWorldQuickStep. Maybe you should change the step size. This value specifies how much movement takes place each step. I use a step size of 0.05f most of the time. Don't know what ODEs default is...

About the collision thing: I didn't even try with .dbo-models! Maybe the normals data gets messed up when converting from .x to .dbo! But I have to get into that...
How do you save/create your .dbo-files? Through DarkGDK-code (the built-in function) or with another program? I know that FragMotion can export to .dbo, maybe you should try that.

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 17th Feb 2010 14:10
Maybe you should use your current framerate to determine what value dWorldStep should be. Use dbScreenFPS(), if 0.05 is good for 60fps that gives you a factor of 1200 to divide your fps by, this way if your game slows down to 30fps the physics simulation will run at same speed.

binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 17th Feb 2010 22:29 Edited at: 17th Feb 2010 22:30
Yea... most likely i am going to implement some sort of timing system, so i can keep the simulation from slowing down. But as for dWorldQuickStep, i am currently using: dWorldQuickStep(world,0.01); Also, as for the dbo files, i am using .dbo files that were created from 3d world studio. Collision on the top of the building works, but then when you try and collide with the side, you just go right through.
binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 18th Feb 2010 23:30 Edited at: 19th Feb 2010 01:50
So what did you guys use for your

dWorldSetLinearDamping(World, 0.001);
dWorldSetAngularDamping(World, 0.005);

values. Also i found out that on DBO files, collision works for the ceiling and the floor, but not the walls. weird huh! UPDATE: Collision on walls does not work on ODE with .x files. Im exporting these files from 3d world studio.

UPDATE AGAIN!: Alright i figured out that collision works with everything on dbo files! The problem is that when i move the dynamic object(character controller), its moving so fast it just bursts right through the wall. Is there anyway at all to make the wall impenetrable at high speeds? At low speeds, just a balling bouncing in a tri-mesh room works, but if you speed up the object u can just burst right through the wall.

Thanks!

Also my nearcallaback and method of triangle mesh collision

For the trimesh it creates a static one. Any help would be appreciated.
Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 19th Feb 2010 05:03
that happens in most if not all collision systems in most games. its natural... you could try and scale down your game... although im sure there must be something else.

hi
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 19th Feb 2010 11:31 Edited at: 19th Feb 2010 11:32
Have you tried with a model that is not made with world studio?

EDIT:
oops, didn't see your last update!

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: 19th Feb 2010 12:47
So wha do you think I should do about this collision problem? Should I try scaling dow my entire world? Is there anyway to fix this? Thanks!
Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 20th Feb 2010 02:38
hmmm i dont wknow if scaling down or scaling up do a general search about collision...

hi
binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 20th Feb 2010 20:35 Edited at: 20th Feb 2010 22:35
Alright i figured out that by setting the worlds ERP higher, it has seemed to have fixed the problem. Now i just have one more issue, when the character controller collides with the wall, it shoots off. Is there any way to disable X and Z motion in ODE on an object?

EDIT: Even by setting the ERP higher, there are still some times where the objects still just burst through. Also scaling down doesnt do anything either.

Thanks!
binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 22nd Feb 2010 01:55
Anybody? Pauli, i know you must know something?
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 22nd Feb 2010 16:56
Okay okay

I didn't really mess with ERP at all, but I'm using a value of 0.2f right now.

Quote: "Is there any way to disable X and Z motion in ODE on an object?"


Well, I'm not sure if that's what you want, but you could save the X and Z position in your main loop before physics happen. Then you reset the X and Z position of your object back to these saved values after physics took place. That way the physics simulation will only affect the Y position of your object.
Maybe you will have to reset velocity in X and Z direction, too.

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: 22nd Feb 2010 20:24 Edited at: 22nd Feb 2010 20:39
Ok thanks. Now what about my collision problem? Is it my nearcallback? Could it be my stepsize? At low speed the objects collide fine. But then at high they jst burst through and hav a tiny bit of collision responce.

Just tried messing around with stepsize, and it hasnt seemed to change anything so thats ruled out. I really think its something in my nearcallback, cause thats where all the collision occurs, and my collision isnt working properly. Also my nearcallback is posted in an earlier post if anyone needs to see it.
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 22nd Feb 2010 23:09
I just looked at your NearCallback and can't see anything wrong in there. I may take a closer look soon, as this function is VERY important for any ODE simulation!
Maybe it helps if you set the Soft_CFM of contact surface to 0.01f (that's what I use, but I'm not even quite sure what this means).

But remember that very large speeds/velocities can cause trouble in almost any physics system.
How exactly do you accelarate your objects to these large speeds?

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: 23rd Feb 2010 01:32 Edited at: 23rd Feb 2010 01:35
Thanks pauli!! Alright ill try that cfm. Also the objects arnt going fast at all. Its just a character controller so its go around 5 units per second. If you take a look at the demo above, you can see how fast its going and my collision problem. If you want to kno exactly, I use the move object command, then get the objects position and reposition it in ode.

Thanks soo much!
binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 23rd Feb 2010 22:45 Edited at: 23rd Feb 2010 23:29
Alright... well i figured out that my problem was how i was moving the character. Basically i was using the ode position function, which would position it through the wall. Now i am using the acceleration command, which seemed to have fixed the problem. Now my question is how can i get the character to move in the direction it is facing only using dbodysetlinearacceleration command? Basically how does dbMoveObject work?

Thanks!
binsky
15
Years of Service
User Offline
Joined: 6th Feb 2009
Location:
Posted: 24th Feb 2010 00:20
Alright, so i just setup some new code to move around my object, and it works pretty good. Here it is!



Now by using set object linear velocity, that fixed the collision problem. Now i just have one little smaller problem. In order to stop the object from "Bouncing" i set the linear velocty to 0 in my main loop. The problem with this is that first it ruins my gravity (y value) and makes it very slow, and also when the object collides with the wall, it bounces and then goes back. This is very annoying. Is there anyway so that it will collide with the wall and not bounce? I attatched a demo below to show my issue. In order to see it, go over the edge of the building and run into the wall.

Thanks!

Attachments

Login to view attachments
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 24th Feb 2010 01:53
Quote: "Basically i was using the ode position function"

If you just had told me that earlier Of course it will go through the wall like this! When using a complex physics system like ODE you better work with changing velocities, forces, ...

Well, I don't really see why you made your movement (your code) like this! Why don't you just apply a relative force to your character?
I bet you can find some easy tutorials through your fav. search machine

About the bouncing thing: you could just change the bounce parameter of the contact surface in your NearCallback to 0.0f!

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: 24th Feb 2010 03:46
Ahh ok! But if i change the bounce in my nearcallback, wont that affect all the objects. Is there a way to set the bounce to 0.0 for just one object??
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 24th Feb 2010 13:16
Yes it's possible, but you have to come up with some sort of data management for that. Think of an array of a surface structure (with elements bounce, friction,...). Then you access that data depending on the objects that are colliding (the objects are o1 & o2 in your NearCallback).
You see that NearCallback is very important.

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: 24th Feb 2010 14:47
ok cool! Ill have to look into that. Now what about my gravity when the set the acceleration to zero in my main loop, it screws up gravity and makes the gravity very slow. If you take a look at the demo when you fall off the building u fall very slow. Is there anyhway to only reset the x and z acceleration to 0 and leave the y alone? Or should I just set y to my gravity valuue?

Thanks for all your help pauli!
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 24th Feb 2010 15:15
No problem, helping others keeps your brain cells going

Yes, I think setting the Y velocity to gravity should do the job.

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.

Login to post a reply

Server time is: 2024-10-05 16:29:21
Your offset time is: 2024-10-05 16:29:21