Player Physics?

Posted By: Nadester

Player Physics? - 11/18/03 05:12

Hey, I am quite new to the a6 physics engine, just now I am deciding to pick it up. My question is : What would simple player physics look like? I'm sure that they would be more powerful than standard physics, right? Does anyone have any examples?
Posted By: ventilator

Re: Player Physics? - 11/19/03 08:14

physics engines aren't very suited for bipeds controlled by the player. it's better to script that with commands like vec_accelerate...
Posted By: kopitzki

Re: Player Physics? - 01/06/04 09:18

Why aren't physics engines suited for players? Can they only handle a one-frame model?
I'm asking this because I scripted a player moving as usual, then being pushed by a normal ent_move - ball, then changing into a ph-entity himself bouncing around, then changing back into a normal entity ready to be pushed again, in a nutshell: a player constantly changing between the states of a usual and a physics entity.
The point is: the engine breaks down after some time of changing back and forth. If I define the player as watched=my, it breaks with the first hit even. No warning message given.
Are there tricks of how to combine moving models and the ph-engine though?
Posted By: muyoyo

Re: Player Physics? - 01/07/04 01:58

Nadester,u can try it urself by downloading them,it is very great i must tell u,but i still dont know how to implement the physic in game:p some say ent_move cant be used?but i really like the physic engine especially ball part,the ball bounce and perform a realitic projectile motion(i working on my own projectile code:p)
Posted By: kopitzki

Re: Player Physics? - 01/07/04 09:06

1. "What would simple player physics look like? I'm sure that they would be more powerful than standard physics, right? Does anyone have any examples?
2. "physics engines aren't very suited for bipeds controlled by the player."

Answer:

Posted By: vrkaya

Re: Player Physics? - 01/08/04 00:43

I don't have an example because, right now, I don't think it's possible - but here's what I think player physics might look like.

Use the example of your standard shooter. Imagine you are creeping through a room when suddenly you hear an explosion and then your body (and viewpoint) are slammed to the left, striking the wall and coming to a sudden stop. If player physics were possible I could see them used in this way to react to a force (e.g. bullet, weapon) striking the player. A 2nd example is if you're shot in the right shoulder from in front, and then the player and viewpoint spin to the right and fall back some.

You can see the ragdoll example in the Newton Game Physics exhibiting this type of behavior, but right now, the ragdoll is not the player. Basically, though, the player's body would react realistically to outside forces.

The only possibility I see now is a method of propelling the player with an impulse instead of the current technique of using movements.

Ron
Posted By: muyoyo

Re: Player Physics? - 01/08/04 03:30

download the demo,interactive demo can help you get better understanding:p
Posted By: fastlane69

Re: Player Physics? - 01/08/04 07:38

In my project, everything is physical, players included. Here, the player arrows control the magnitude and direction of a skill named net_force_x, net_force_y, and net_force_z. These skills are then processed by an while/wait update routine that applied a phent_addlocalforce in accordance to the player intentions. I use a multiple combination of simultanous forces for stablity instead of just one force on the players center. Furhtermore, I had to make sure that my forces where PULLING (ie applied in front of the entity) instead of PUSHING (applied from behind) in order to increase biped stability. At low speeds and accelerations (around 500 quants/s and 50 quants/s/s), this configuration and the player movement is stable. Any higher and he becomes unstable.

It's pretty nice to have player collision controlled by the PE. It looks damn tight and when you slam into a bunch of static looking barrels, they, being physical too, respond in kind.

IMHO therefore, while the current PE is not optimal for bipeds, it can be done and it looks damn slick!

I think your problems may also have to do with registering and unregestering physical entities. I too have had (unrelated?) problems with the physics engine focusing on the registering of physics ents.
Posted By: muyoyo

Re: Player Physics? - 01/08/04 19:29

to bad i am using a5.5:p it doesnt recognize the command to implement the physic in script:p i get a6 later:p
Posted By: fastlane69

Re: Player Physics? - 01/09/04 06:32

The newton engine is free (?) and is compatable with A5 (?). I put question marks cause I'm not 100% sure on both those facts, but if you want physics without the 3DGS PE, you should look at the Newton Physics Engine threads.
Posted By: seb_dup1

Re: Player Physics? - 01/09/04 07:59

Quote:

The newton engine is free (?) and is compatable with A5 (?). I put question marks cause I'm not 100% sure on both those facts, but if you want physics without the 3DGS PE, you should look at the Newton Physics Engine threads.





The Newton engine is free and compatible with A5.51, A5.551 and A6.xx,all comercial version or better.

NB: Newton wrote :"I did not test it on versions lower than comercial but it should work fine" .
Posted By: kopitzki

Re: Player Physics? - 01/16/04 00:50

would like to pick up your thread, fastlane,
my player code includes
while(1)
{
phent_enable(my,0);// disable physics
inputmove();//ent_move player, can be replaced by addforcelocal after phentenable
anime();// defining the animating frames of the model
phent_enable(my,1);// enable physics
wait(1);
}

all works fine, even ent_move when physics are disabled - but:
the model shows fine smooth physics behavior only with ph_type SPHERE (some force constantly pulling down the feet), with a ph_type BOX set it starts getting shakybumpingbouncy - especially with collisions - like a BOX. When set to SPHERE it doesn't fit through doors anymore. So how do you make the model stick firmly to the ground while running its animation frames and moving it?
Posted By: fastlane69

Re: Player Physics? - 01/20/04 02:30

Hmmm, there are alot of things to consider re: the workings of the Physics Engine before we go too indepth into your code:

a) what is your gravity set to? (ph_setgravity)
b) what is your elasticity set to? (phent_setelasticity)
c) do you have any of the corrections set and what to? (phent_setmasspeed and ph_setcorrections)

Perhaps in answering this question and messing with these parameters you get more stable behaiviour. Otherwise, post you settings (or lack thereof) and we can take it from there.
Posted By: kopitzki

Re: Player Physics? - 01/21/04 23:53

In Antwort auf:


a) what is your gravity set to? (ph_setgravity)
b) what is your elasticity set to? (phent_setelasticity)
c) do you have any of the corrections set and what to? (phent_setmasspeed and ph_setcorrections)





gravity is set to nullvector (the model being pulled down by phentaddforcelocal to feet: no other way because the other models have no gravity), elasticity to 50,10, (because I want the player to bounce off walls) and the corrections to default, and maxspeed to some feasible limits (I guess 500 and 500);
Do these settings have any terrible effect on my model's behavior?


Posted By: fastlane69

Re: Player Physics? - 01/22/04 04:19

It's been my experience that simulating gravity using phent_addforce IS NOT the same as setting your grav_vec.

I was trying to remember where I saw your behaiviour in my code and this was it; when I manually set grav (using phent_add), I too got that shaky bouncybehaiviour when I "landed" on the gound. My final conclusion was that the Physics Engine kept trying to pull the object down to the ground and this set up all kinds of nasty instabilitys with bouncing and shaking. In other words, I was unable to have an object stabling pushing on another surface. You could set your elasticity to 0 and this would stabilize your gravity, but as you said, then you wouldn't be able to bounce off walls.

Some things to try out:

1) play around with ph_setcorrections. Make it unforgiving (ie a high correction value) and it might stabilize your movement. If using the physics engine, it's good to familirize yourself and optimize the ph_setcorrections since the default values ofter aren't good enough for our projects.

2) You might want to turn on gravity to have your player be smooth and then apply a phent_addGLOBALforce (needs to be global since gravity is global) pointing up (opposite the direction of your grav_vec) to all other object to counteract gravity and thus simulate null grav. This way, your player will be the only one to fall under gravity, but your other entities should move as it there was no gravity. Not sure about this method though
Posted By: kopitzki

Re: Player Physics? - 01/22/04 06:27

Your second idea seems to be it, thanks a lot!
© 2024 lite-C Forums