Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
0 registered members (), 635 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problem with the physics engine (player acceleration) #221109
08/12/08 12:30
08/12/08 12:30
Joined: Aug 2008
Posts: 4
D
DDFD Offline OP
Guest
DDFD  Offline OP
Guest
D

Joined: Aug 2008
Posts: 4
Hello,

I dont have much experience with 3DGS, yet, but I wanted to make physics into my little game. But when the physics are activated and I press the key to move the player and then release the key, the acceleration of the player is too high. So the player slids a bit (like on ice) and then stops. How can I put off the acceleration of the player or make, that the player stops, when I release the key, but keep the physics of the player? Please help me.
P.S. Sorry for my bad english. I'm german.

Hallo,

Ich hab noch nicht so viel Erfahrung mit 3DGS, aber ich wollte Physik in mein kleines Spiel bringen. Das Problem ist aber, wenn die Physik aktiviert ist und ich die Taste drücke um mit dem Player zu laufen und dann die Taste loslasse, ist die Beschleunigung vom Player so hoch, dass der Player noch ein kleines bisschen auf dem Boden rutscht (wie auf Eis), bis er stoppt. Wie kann ich also die Beschleunigung des Players abschalten oder es schaffen, dass der Player sofort stoppt, wenn ich die Taste loslasse, ohne die Physik des Players abzuschalten? Bitte helft mir.

Re: Problem with the physics engine (player acceleration) [Re: DDFD] #221120
08/12/08 13:44
08/12/08 13:44
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
hiho,
Versuche mal mit
phent_setdamping ( entity, var linear, var angular );
und
phent_setfriction ( entity, var friction );
zu spielen.
vermutlich hast du zuwenig Reibung/Dämpfung definiert, dies resultiert dann in eine Bewegung wie auf einer Eisfläche, genau so wie du es beschrieben hast.

cheers

zwecki

Re: Problem with the physics engine (player acceleration) [Re: zwecklos] #221146
08/12/08 14:47
08/12/08 14:47
Joined: Aug 2008
Posts: 4
D
DDFD Offline OP
Guest
DDFD  Offline OP
Guest
D

Joined: Aug 2008
Posts: 4
Danke, aber das funktioniert leider auch nicht so gut. Wenn ich phent_setdamping benutze, fällt der Player ganz langsam auf den Boden und die Erdanziehungskraft funktioniert nicht mehr so gut. Und wenn ich phent_setfriction(me, 50) benutze, fällt das Modell des Players, wenn man ihn bewegt sofort um. Bitte helft mir weiter.


Thanks, but that didn't work so good. When I use phent_setdamping, the player drops slowly to the ground and the gravity didn't work so good anymore. And when I use phent_setfriction(me, 50), the modell of the player falls when you move the player. Please help me.

Re: Problem with the physics engine (player acceleration) [Re: DDFD] #221337
08/13/08 14:57
08/13/08 14:57
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
Sorry für die späte Antwort,

Dein Modell fällt um?
Was hast du für eine PH Hülle definiert?

Kannst du mal den relevanten Teil deines Skriptes posten?
Vielleicht kann man dir dann besser helfen.

cheers

zwecki

Re: Problem with the physics engine (player acceleration) [Re: zwecklos] #221557
08/14/08 18:20
08/14/08 18:20
Joined: Aug 2008
Posts: 4
D
DDFD Offline OP
Guest
DDFD  Offline OP
Guest
D

Joined: Aug 2008
Posts: 4
Hallo,
Hier ist der Teil des Skriptes:

action player_main()
{
player = me;
set(my, SHADOW);

phent_settype(me, PH_RIGID, PH_BOX);
phent_setmass(me, 80, PH_BOX);
phent_setelasticity (me, 0, 100);
phent_setdamping (me, 0, 0);
phent_setfriction(me, 50);
phent_setgroup(me, 1);

while(1)
{
phent_addforcelocal(my, vector((key_w * (key_shift + 1) - key_s)*400000*time_step, (key_a - key_d)*400000*time_step, 0), nullvector);
phent_addcentralforce(my, vector(0, 0, key_space*400000*time_step));
ent_animate(me, "walk", my.skill21 ,ANM_CYCLE);
my.skill21 += 100 * time_step / 28;
if (key_w == 0 && key_a == 0 && key_s == 0 && key_d == 0 && key_cuu == 0 && key_cud == 0 && key_cul == 0 && key_cur == 0)
{
my.skill21 = 0;
ent_animate(me, "stand", my.skill22, ANM_CYCLE);
my.skill22 += 3 * time_step;
}
update_views();
wait(1);
}
}

Sobald ich friction höher stelle kippt das Modell leichter um. Gibt es vielleicht einen Ersatz für "phent_addforcelocal", bei der das Modell nicht weiterrutscht nach dem Loslassen der Taste? Oder kann man das irgendwie abstellen?

Danke für die Hilfe.

Re: Problem with the physics engine (player acceleration) [Re: DDFD] #221691
08/15/08 14:51
08/15/08 14:51
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
Hallo,
Was passiert wenn du zbsp. phent_setdamping(spieler,100, 100);
definierst?
Ist dann das langsame Herunterfallen das einzige Problem?

Versuch mal friction auf 0 zu setzten und damping auf 100.

phent_setfriction(spieler, 0.0);
phent_setdamping(spieler, 100.0, 100.0);

Du kannst via c_trace feststellen, ob dein Spieler sich in der Luft befindet, wenn ja, kannst du mit
phent_addcentralforce(my, vector(0, 0, -5000);
die Fallgeschwindigkeit erhöhen um dem entgegen zu wirken.

cheers

Re: Problem with the physics engine (player acceleration) [Re: zwecklos] #221886
08/16/08 21:35
08/16/08 21:35
Joined: Aug 2008
Posts: 4
D
DDFD Offline OP
Guest
DDFD  Offline OP
Guest
D

Joined: Aug 2008
Posts: 4
Hallo,
Vielen Dank. Das mit c_trace war eine gute Idee.
Hier die (hoffentlich gute) Umsetzung

action player_main()
{
player = me;
set(my, SHADOW);

phent_settype(me, PH_RIGID, PH_BOX);
phent_setmass(me, 80, PH_BOX);
phent_setelasticity (me, 0, 100);
phent_setdamping (me, 100, 100);
phent_setfriction(me, 0);
phent_setgroup(me, 1);

while(1)
{
jump = key_space;
if(c_trace(vector(my.x, my.y, my.z - 16), vector(my.x, my.y, my.z - 40000), USE_BOX|IGNORE_PASSABLE|IGNORE_ME) > 0)
{
phent_addforcelocal(my, vector((key_w * (key_shift + 1) - key_s)*400000*time_step, (key_a - key_d)*400000*time_step, -200000), nullvector);
ent_animate(me, "walk", my.skill21 ,ANM_CYCLE); //Walk-Animation
my.skill21 += 100 * time_step / 28;
if (key_w == 0 && key_a == 0 && key_s == 0 && key_d == 0 && key_cuu == 0 && key_cud == 0 && key_cul == 0 && key_cur == 0)
{
my.skill21 = 0;
ent_animate(me, "stand", my.skill22, ANM_CYCLE); //Steh-Animation
my.skill22 += 3 * time_step;
}
update_views();
}
else
{
do
{
phent_addforcelocal(my, vector((key_w * (key_shift + 1) - key_s)*400000*time_step, (key_a - key_d)*400000*time_step, jump*800000*time_step), nullvector);
ent_animate(me, "walk", my.skill21 ,ANM_CYCLE); //Walk-Animation
my.skill21 += 100 * time_step / 28;
if (key_w == 0 && key_a == 0 && key_s == 0 && key_d == 0 && key_cuu == 0 && key_cud == 0 && key_cul == 0 && key_cur == 0)
{
my.skill21 = 0;
ent_animate(me, "stand", my.skill22, ANM_CYCLE); //Steh-Animation
my.skill22 += 3 * time_step;
}
update_views();
wait(1);
}
while(jump && c_trace(vector(my.x, my.y, my.z - 16), vector(my.x, my.y, my.z - 40000), USE_BOX|IGNORE_PASSABLE|IGNORE_ME) <= 50);
}
update_views();
wait(1);
}
}

Bis zum nächsten Problem. ;-)


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1