3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: ball physics
#15965
08/03/03 09:13
08/03/03 09:13
|
Joined: Sep 2001
Posts: 237 Maine, USA
Jason Bryant
OP
Member
|
OP
Member
Joined: Sep 2001
Posts: 237
Maine, USA
|
Here is the player input code.. that includes the jump as well.. code:
//----------------------Player Input------------------------------------- function playerInput() { // this function is called every frame from player player action // reset the force vector each frame force.x = 0; force.y = 0; force.z = 0;
//allow control of ball if on the ground... if (ground_dist > 0 && ground_dist < scale_dist) { if(key_cuu) { vec_set(temp.x,camera.x); temp.z = player.z; vec_diff(force.x,player.x,temp.x); vec_normalize(force,power); //force vector points from camera to player at length of power } if (key_cud) { vec_set(temp.x,camera.x); temp.z = player.z; vec_diff(force.x,player.x,temp.x); vec_inverse(force); vec_normalize(force,power); } if(key_cul) { vec_set(temp.x,camera.x); temp.z = player.z; vec_diff(force.x,player.x,temp.x); force_ang.pan = 90; vec_rotate(force,force_ang); vec_normalize(force,power); } if(key_cur) { vec_set(temp.x,camera.x); temp.z = player.z; vec_diff(force.x,player.x,temp.x); force_ang.pan = -90; vec_rotate(force,force_ang); vec_normalize(force,power); } } // add flying force here.... if(mouse_right) { //activate current powerup here... //will use mousewheel to cycle powerups force.z = glide_power; //to allow control while flying if(key_cuu) { vec_set(temp.x,camera.x); temp.z = player.z; vec_diff(force.x,player.x,temp.x); vec_normalize(force,power); //force vector points from camera to player at length of power } if (key_cud) { vec_set(temp.x,camera.x); temp.z = player.z; vec_diff(force.x,player.x,temp.x); vec_inverse(force); vec_normalize(force,power); } if(key_cul) { vec_set(temp.x,camera.x); temp.z = player.z; vec_diff(force.x,player.x,temp.x); force_ang.pan = 90; vec_rotate(force,force_ang); vec_normalize(force,power); } if(key_cur) { vec_set(temp.x,camera.x); temp.z = player.z; vec_diff(force.x,player.x,temp.x); force_ang.pan = -90; vec_rotate(force,force_ang); vec_normalize(force,power); } } //jumping... if(mouse_left) { // only allow jump if on ground, not in air if (ground_dist > 0 && ground_dist < scale_dist) { jumping = 4; while(jumping>0) { // play jump sound here snd_play(boing,sound_vol,0); force.z = jump_power; jumping-=1; wait(1); } } } //force vector now contains player intention forces }
Jason
|
|
|
Re: ball physics
#15967
08/03/03 16:58
08/03/03 16:58
|
Anonymous
Unregistered
|
Anonymous
Unregistered
|
quote: Originally posted by fastlane69: a) Because I can
b) Because I honestly thought you were showcasing your work, not asking any questions.
c) See a)
Harassing and Annoying...that's the polices job, not mine.
Get a life dude, damn....
|
|
|
Re: ball physics
#15969
08/03/03 20:47
08/03/03 20:47
|
Joined: Sep 2001
Posts: 237 Maine, USA
Jason Bryant
OP
Member
|
OP
Member
Joined: Sep 2001
Posts: 237
Maine, USA
|
This is the physics setup of the ball. I'm only using a mass of 5. (normal_friction = 50 and normal_damping = 60 currently) code:
phent_settype(my,PH_RIGID,PH_SPHERE); phent_setgroup(my,2); phent_setmass(my,5,PH_SPHERE); phent_setfriction(my,normal_friction); phent_setelasticity(my,50,40); phent_setdamping(my,normal_damping,normal_damping); player=my;
I'm using ph_setcorrections(20000,0.1);
I will set it up so that I can adjust these values on the fly and see if that helps. Thanks for the tips.
Jason
|
|
|
Re: ball physics
#15972
08/04/03 16:41
08/04/03 16:41
|
Joined: May 2002
Posts: 7,441
ventilator
Senior Expert
|
Senior Expert
Joined: May 2002
Posts: 7,441
|
marble.zip -> my experiments - you can look into the wdl to see how i did it. i used phent_addtorqueglobal to move the ball because i think it's cooler when the ball slips a little. controls: wasd, right mouse button + scroll wheel to control the camera are you able to let the sphere fall through the level? i still can do it but only because i know where and how... it seems to work somewhat better with the current beta because there i could limit the rotation speed. with 6.00.6 i had to disable this part because there is a bug in phent_getvelocity. but even in the beta i can let the sphere fall through the level...
|
|
|
Re: ball physics
#15973
08/04/03 22:33
08/04/03 22:33
|
Joined: Apr 2003
Posts: 111 france
seb_dup1
Member
|
Member
Joined: Apr 2003
Posts: 111
france
|
Ventilator Under the square pipe , the ball get stuck ..He he Not enough force?
|
|
|
|