4 registered members (ozgur, Ayumi, VHX, monarch),
1,161
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Player moving with vehicle (english&deutsch)
#177542
01/11/08 23:21
01/11/08 23:21
|
Joined: Dec 2007
Posts: 34
Luzifer
OP
Newbie
|
OP
Newbie
Joined: Dec 2007
Posts: 34
|
Hello, I'm trying to make a game that has the following premise: The player is in full first-person shooter mode but controls the vehicle (space vessel or something of a floating "sky boat") he is in through panels. Well, I'm only at the beginning but the first major problem I ran into is, that the player does not move with the ship. I have a rather simple move function for the player and when I use c_move or ent_move for the vehicle (I will use a Map Entity) the player stands on it but does not move with the ship nor collide with its walls. Is there a way to get this to work? Hallo, ich versuche momentan ein Spiel zu machen, das folgendem Prinzip folgt: Der Spieler hat volle Ego-Shooter-Steuerung, aber kontrolliert das Gefährt in dem er sich befindet (Raumschiff oder sowas wie ein fliegendes Boot) durch Panels. Nun, ich bin erst am Anfang, aber ich das erste große Problem, das ich jetzt habe ist, dass der Spieler sich nicht mit dem Schiff bewegt. Ich habe eine eher einfache move function für den Spieler und wenn ich ich c_move oder ent_move für das Gefährt nutze (ich werde eine Map Entity benutzen) bleibt der Spieler zwar drauf stehn, aber bewegt sich nicht mit dem Schiff und kollidiert auch nicht mit dessen Wänden. Gibt es eine Möglichkeit, das zum funktionieren zu bringen? Edit: I managed to get make the player move with the ship. Only thing that's missing is now the pan. Nothing I tried worked so far... (add_vec, vec_rotate, ang_to_vec) Ich habs geschafft, dass der Player sich mit dem Schiff bewegt. Jetzt fehlt nurnoch der Pan. Nichts, was ich bisher versucht hab, hat geklappt... (add_vec, vec_rotate, ang_to_vec) Code:
vec_add(player.x,my_speed);
Last edited by Luzifer; 01/12/08 01:51.
|
|
|
Re: Player moving with vehicle (english&deutsch)
[Re: Luzifer]
#177543
01/13/08 14:13
01/13/08 14:13
|
Joined: Dec 2007
Posts: 34
Luzifer
OP
Newbie
|
OP
Newbie
Joined: Dec 2007
Posts: 34
|
Anyone? What I basically need is a moving platform that can turn and fly around and take the player with it. It can't be that hard, I just don't know what to do. That's what I have so far: Code:
action player_ship { ship = me; while(1) { my.polygon = on; my.fat = on; c_rotate(me,vector(ship_pan*time_step,0,0),glide|ignore_passable|ignore_passents); c_move(me,vector(ship_force*time_step,0,0),nullvector,ignore_passable|ignore_passents|glide);
vec_add(player.x,my_speed); wait(1); } } The question is, how do I get him to change his position with the rotation of the ship/platform and also change his pan accordingly?
|
|
|
Re: Player moving with vehicle (english&deutsch)
[Re: Luzifer]
#177544
01/13/08 16:07
01/13/08 16:07
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
it would be llike this Code:
action player_ship { var oldpos; ship = me; my.polygon = on; my.fat = on; while(1) { vec_set(oldpos,my.x); c_rotate(me,vector(ship_pan*time_step,0,0),glide|ignore_passable|ignore_passents); c_move(me,vector(ship_force*time_step,0,0),nullvector,ignore_passable|ignore_passents|glide); vec_set(temp,vector(0,0,100)); vec_rotate(temp,my.pan); vec_add(temp,my.x); c_trace(my.x,temp,use_polygon); if(you == player) { vec_diff(temp,my.x,oldpos); c_move(me,nullvector,temp,ignore_passable|ignore_passents|glide); temp = player.pan + ship_pan c_rotate(me,vector(temp*time_step,0,0),glide|ignore_passable|ignore_passents); } wait(1); } }
didnt test it
"empty"
|
|
|
Re: Player moving with vehicle (english&deutsch)
[Re: Luzifer]
#177546
01/13/08 17:04
01/13/08 17:04
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
srry did somthing wrong vec_set(temp,my.x); temp.z +=100; c_trace(my.x,temp,use_polygon);
"empty"
|
|
|
Re: Player moving with vehicle (english&deutsch)
[Re: flits]
#177547
01/13/08 17:19
01/13/08 17:19
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
remove the following line from your script: my.polygon = on; Quote from the manual regarding the polygon flag: Quote:
Only one of the objects involved in a collision should have a polygonal hull. Do not set this flag for moving objects or for animated models.
edit: Next thing is: If you already have a player movement take a look at it how it handles gravity. Usually this is done via some c_trace, now add the ACTIVATE_SONAR flag to that c_trace instruction and let your platform react to that. If the EVENT_SONAR of the ship entity is activated, the player is on the platform. You could additionally compare the z-position to check if the player is standing on the ship or jumping above it. If he jumps you don't add the moving vector of the ship to the players moving vector. If he is not jumping and thus standing you add it to it or rather perform a c_move(player ...) to force the player the same way.
But: Be carefull with the relativ and absolute move vector. Best thing is to translate the relativ movement of the ship into an absolute moving vector and apply that to the player.
hope this helps a bit.
Last edited by Xarthor; 01/13/08 17:24.
|
|
|
Re: Player moving with vehicle (english&deutsch)
[Re: flits]
#177548
01/13/08 17:25
01/13/08 17:25
|
Joined: Dec 2007
Posts: 34
Luzifer
OP
Newbie
|
OP
Newbie
Joined: Dec 2007
Posts: 34
|
Hey, thank you, but that doesn't seem to be the problem. I tested your idea with my old version but it reset the ship's pan in irregular intervals and caused other weird effects. I tried to implement your ideas but either they don't work at all or I don't understand them correctly. Here is my new version, where I moved the setting of the player's position from the ship's action to the player's (excerpts): Code:
action player_act() {
...
//turn and move the player move_min_z = 0.9; c_rotate(me,vector(my.skill24,0,0),glide|ignore_passable|ignore_passents); c_move(me,my.dist_rel,my.dist_abs,glide|ignore_passable|ignore_passents); //move him with ship and other ship-related stuff vec_set(temp, my.x); temp.z -= 3000; result = c_trace(my.x, temp, ignore_me|use_box); if (you == ship) { ship_controls.visible = on; vec_add(my.x,ship_vector); } else { ship_force = 0; ship_pan = 0; ship_controls.visible = off; }
...
}
action player_ship { ship = me; my.polygon = on; c_setminmax(my); my.push = 80; while(1) { c_rotate(me,vector(ship_pan*time_step,0,0),glide|ignore_passable|ignore_passents|ignore_push); c_move(me,vector(ship_force*time_step,0,(key_cuu-key_cud)*10*time_step),nullvector,ignore_passable|ignore_passents|glide|ignore_push); vec_set(ship_vector,my_speed);
wait(1); } }
Still...same problem.
Last edited by Luzifer; 01/13/08 17:33.
|
|
|
Re: Player moving with vehicle (english&deutsch)
[Re: Xarthor]
#177549
01/13/08 17:31
01/13/08 17:31
|
Joined: Dec 2007
Posts: 34
Luzifer
OP
Newbie
|
OP
Newbie
Joined: Dec 2007
Posts: 34
|
@Xarthor
Sorry, posted before I saw your reply. Thank you for the small corrections, but I already got most of that stuff handled. My problem is not the moving vector of the platform or detecting it, but correcting the player's position and pan if the platform pans. (in my case the 'platform' is actually a small spaceship)
Means: If the player is in the center of the platform, we would only have to adjust the player's pan (even that is a problem, because if I just add the angle the player starts to rotate uncontrollably, for some reason). But if he is further towards an edge, he has to be moved (rotated) around the platform's axis, so he will still stand at the same position. PLUS, his pan must be changed accordingly. And all that while he can still freely walk around the platform...
Last edited by Luzifer; 01/13/08 17:34.
|
|
|
Re: Player moving with vehicle (english&deutsch)
[Re: Luzifer]
#177550
01/13/08 20:27
01/13/08 20:27
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
Code:
action player_act() { var tempa; //turn and move the player while(1) { move_min_z = 0.9; c_rotate(me,vector(my.skill24,0,0),glide|ignore_passable|ignore_passents); c_move(me,my.dist_rel,my.dist_abs,glide|ignore_passable|ignore_passents); //move him with ship and other ship-related stuff vec_set(temp, my.x); temp.z -= 3000; result = c_trace(my.x, temp, ignore_me|use_box); if (you == ship) { ship_controls.visible = on; vec_diff(temp,my.pan,ship_pan); //if only pan add this lines //temp.tilt = 0; //temp.roll = 0; c_rotate(me,temp,glide|ignore_passable|ignore_passents); vec_set(temp,ship_vector); c_move(me,temp,nullvector,glide|ignore_passable|ignore_passents); } else { ship_force = 0; ship_pan = 0; ship_controls.visible = off; } wait(1); } }
action player_ship { ship = me; c_setminmax(my); my.polygon = on; my.push = 80; while(1) { c_rotate(me,vector(ship_pan*time_step,0,0),glide|ignore_passable|ignore_passents|ignore_push); c_move(me,vector(ship_force*time_step,0,(key_cuu-key_cud)*10*time_step),nullvector,ignore_passable|ignore_passents|glide|ignore_push); vec_set(ship_vector,my_speed); vec_set(ship_pan,my.pan); wait(1); } }
only when you turn this gives a litle problem
"empty"
|
|
|
|