Physics Player

Hi there.

I am sitting here with a situation!



I want to know how would one do this?

I need a way of creating a physics player in my levels.

This can be a box or sphere, but the player must be able to control this object and

the object should still act as a synamic physics object in the world.

So, if the player move on the terrain the object should stick on it and

if that object encounters another physics object it should stop against it or bump it!

And if the player jumps and hit something, it should take physics also into acount!



Please help.

Darkprophet, if you have any idea let me know!

don't what part of the U.k the kid is from but I'm kinda interested in finding out if he is O.K after the events of yesterday

mcbeth said:

don't what part of the U.k the kid is from but I'm kinda interested in finding out if he is O.K after the events of yesterday


You mean DP? His profile says: Last Active: 07 July 2005, 19:02:47. That's in my GMT+1 time I assume. So he was fine enough to check into jME it seems, thankfully.

Hey all, im all ok. My dad was really close tho. The underground train he was on exploded after he got off, two stations before it exploded…cutting our luck a bit close eh? Thanks for the headsup tho, it means alot.



As for the player, why dont you just init a sphere (as large as the player), this sphere will act as a "dummy" object. This means that on every update, you get the position/rotation of the sphere and set the player's to be of that…



Now the hard part is turning really…what you want to do is make sure you are only colliding with the terrain (via PhysicsCollisionResults) and if so, sync the sphere with the controls…when a collision occurs, break this cycle and let the sphere do it physically until only the terrain and the player are colliding alone (i should say the dummy sphere and the terrain).



Hope that helps

DP


Just realised that even Unreal Technology 3 and their demos haven't been able to solve this problem. They do what Per has done in Marble Fun which is just to use forces…But obviously for a real human player, this is insufficient. I'l sleep on this and let you know if ive come up with anything clever soon.



And it seems i have the perfect idea…i'l get back to you on that tomorrow…



DP

The sphere idea was exactly what I had in mind, but there is still one problem.

The player will then roll all over the place. That doesn't seem right to me does it!

Did you think about this DP, any ideas?



I thought I can just set the players position to the sphere dummy object and ignore the

rotation of the sphere!

What do you think?

O' and jumping, what about jumping?

Use a box then instead of the sphere…And just apply forces to the box or move it and sync with graphical until you hit something. Which ever way really…



If ignoring the rotation works, then so be it…



Jumping, just add a vertical force onto the box, the physics will handle the rest! :slight_smile:



DP


Using a box as physics representation showed to cause quite strange behaviour on platform/object edges and such (a guy at our university tried it). He finally ended up with a sphere and restricted velocities (did not allow it to roll/turn by setting angular velocities and rotation to 0 each frame). This worked quite well.

Jumping was done - as DP said - by adding an upward force to the sphere (onyl if the sphere was colling with the ground last frame and the last force addition was some time in the past).