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
4 registered members (AndrewAMD, Quad, soulman3, Ayumi), 675 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
Movement Problem - Player hängt nach drehen in Wand fest #394887
02/17/12 13:38
02/17/12 13:38
Joined: Dec 2011
Posts: 13
W
witzdestages Offline OP
Newbie
witzdestages  Offline OP
Newbie
W

Joined: Dec 2011
Posts: 13
Hallo,

ich hatte mir ein Player Code aus nem Aum kopiert und habe damit nur das Problem, das wenn ich ich mich in der nähe von Wänden drehe, das der Player soweit nach oben springt bis er von irgendwas gestoppt wird und dort fest hängt. Der Player kann sich zwar noch drehen und die lauf Animation geht auch noch, aber der Player kommt nicht mehr von der Stelle.

Hier ein Bild davon wie der Player fest hängt: http://oneill.bplaced.net/shot_0.jpg

Wie kann man dieses Problem denn beheben ?
Hatte vielleicht gedacht das man irgendwie den Abstand zu den Wänden irgendwie definieren könnte, habe aber dazu auch nichts gefunden.

Gibt es irgendeine Möglichkeit das das festhängen zu verhindern ?

Hier der Code:

Code:
action player_cam() // player / camera code
{
       VECTOR temp;
       VECTOR temp2;
       var movement_speed = 10; // movement speed
       var anim_percentage;
       var cam_angle = 20; // set the initial camera angle here
       var cam_dist = 100; // set the default zoom in factor here
       var cam_height = 0; // set the default camera height here
       player = my; // I'm the player
       while (1)
         {
                 if((!key_w) && (!key_s)) // the player isn't moving at all?
                   {
                       ent_animate(my, "stand", anim_percentage, ANM_CYCLE); // and play the "stand" animation
               }
                   else // the player is moving?
            {
                       ent_animate(my, "walk", anim_percentage, ANM_CYCLE); // and play the "walk" animation
                   }
               // zoom in / out using the mouse wheel
               cam_dist += 1.2 * mickey.z * time_step;
               // limit the distance between the camera and the player to 20...500
               cam_dist = clamp(cam_dist, 50, 500); 
               // set the height of the camera using the up / down cursor keys
               cam_height += 3 * (key_cuu - key_cud) * time_step; 
               // limit the height of the camera to 50...300
               cam_height = clamp(cam_height, 0, 100);
               // rotate the player using the A / D keys
               my.pan += 4 * (key_a - key_d) * time_step;
            anim_percentage += 5 * time_step; // 5 = animation speed
                   camera.x = player.x - cam_dist * cos(cam_angle);
               camera.y = player.y - cam_dist * sin(cam_angle);
            cam_angle += 5 * (key_cur - key_cul) * time_step; // 5 gives the camera rotation speed
               camera.z = player.z + cam_height;
            vec_set(temp2.x, my.x);
            vec_sub(temp2.x, camera.x);
            vec_to_angle(camera.pan, temp2); // rotate the camera towards the player at all times
            temp.z -= 10000;
            temp.x = movement_speed * (key_w - key_s) * time_step;
            temp.y = 0;
            temp.z = -c_trace (my.x, temp.x, IGNORE_ME | IGNORE_PASSABLE | USE_BOX) - 0.01; // play with 2
            c_move (my, temp.x, nullvector, IGNORE_PASSABLE | GLIDE);
            wait (1);
       }
}



Last edited by witzdestages; 02/17/12 13:39.
Re: Movement Problem - Player hängt nach drehen in Wand fest [Re: witzdestages] #394889
02/17/12 13:51
02/17/12 13:51
Joined: Nov 2002
Posts: 913
Berlin, Germany
S
SchokoKeks Offline
User
SchokoKeks  Offline
User
S

Joined: Nov 2002
Posts: 913
Berlin, Germany
Wenn deine Bounding Box nicht in x und y richtung gleich groß ist
(min_x = max_x = min_y = max_y), dann musst du c_rotate nutzen statt my.pan direkt zu verändern.

Re: Movement Problem - Player hängt nach drehen in Wand fest [Re: SchokoKeks] #394894
02/17/12 14:32
02/17/12 14:32
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Wenn man aber c_rotate(me, camera.pan, GLIDE); macht buggt alles rum frown
Was muss man vorher noch für winkelfunktionen aufrufen?

Re: Movement Problem - Player hängt nach drehen in Wand fest [Re: Ch40zzC0d3r] #394901
02/17/12 14:53
02/17/12 14:53
Joined: Dec 2011
Posts: 13
W
witzdestages Offline OP
Newbie
witzdestages  Offline OP
Newbie
W

Joined: Dec 2011
Posts: 13
OK, habs jetzt raus.

Einfach die Zeile
Code:
my.pan += 4 * (key_a - key_d) * time_step;


mit
Code:
c_rotate(me,vector(time_step * (key_a - key_d) * 5,0,0),GLIDE);


ersetzten.

funktioniert nun wie es soll.

Last edited by witzdestages; 02/17/12 16:38.
Re: Movement Problem - Player hängt nach drehen in Wand fest [Re: witzdestages] #394919
02/17/12 19:01
02/17/12 19:01
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Wie löst man mein problem?
Normalerweise dieser Code:

me.pan = camera.pan;

Wie macht man das mit c_rotate?

Last edited by Ch40zzC0d3r; 02/17/12 19:01.
Re: Movement Problem - Player hängt nach drehen in Wand fest [Re: Ch40zzC0d3r] #394928
02/17/12 20:05
02/17/12 20:05
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
c_rotate(me, vector(my.pan-camera.pan, 0,0), yourmodes...)

Oder camera.pan-my.pan...


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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