Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (7th_zorro, degenerate_762, AndrewAMD, ozgur), 774 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Quick jump code issue #312582
02/25/10 16:11
02/25/10 16:11
Joined: Oct 2009
Posts: 60
T
Tman Offline OP
Junior Member
Tman  Offline OP
Junior Member
T

Joined: Oct 2009
Posts: 60
I have a jump code and it works great for when the player is not moving but when I am running and then jump he seems to glide and not land on his feet, anyone has ideas? Here is a portion of my code.
Code:
// adjust entity to the ground height, using a downwards trace
		if(c_trace(my.x,vector(my.x,my.y,my.z-5000),IGNORE_PASSABLE|IGNORE_ME) > 0)
		dist_down= my.z + vFeet.z - hit.z; // always place player's feet on the ground
		else
		dist_down = 0;	
		
	   
	   if((dist_down > 0))
		{
		 	
		 dist_down = clamp(dist_down,100,accelerate(speed_down,-nc_gravity * time_step,0.1));
		 
		}
		else
	   {
	   	//do the speed down to equal 0 so that he snaps to the ground
	   	speed_down = 0;
	   	if((dist_down + speed_down)> 0)
	   	{
	   		speed_down = - dist_down - 0;
	      }
	      if(key_space == 1)
	      {
	      	jump_target = jump_height * time_step;
	      }
       }
       if(jump_target > 0)
       {
       	speed_down = (sqrt((jump_target)* nc_gravity))*time_step;
         	
       	jump_target -= speed_down ;
        }



This is the jump portion any help is appreciated.

Re: Quick jump code issue [Re: Tman] #312606
02/25/10 16:53
02/25/10 16:53
Joined: Oct 2009
Posts: 60
T
Tman Offline OP
Junior Member
Tman  Offline OP
Junior Member
T

Joined: Oct 2009
Posts: 60
I need to amend my post and this may be the wrong place to put it, I have the jump working perfectly now, but I have a custom model for terrain that was made in Maya and the bounding box surrounds the terrain instead of the terrain being the solid object how do I correct this and if this is the wrong place to ask forgive me and point me in the right direction.

Re: Quick jump code issue [Re: Tman] #312617
02/25/10 17:31
02/25/10 17:31
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Set its POLYGON flag.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Quick jump code issue [Re: Superku] #312629
02/25/10 18:22
02/25/10 18:22
Joined: Oct 2009
Posts: 60
T
Tman Offline OP
Junior Member
Tman  Offline OP
Junior Member
T

Joined: Oct 2009
Posts: 60
I set that but it is like the bbox is covering the entire ground model it is like 500 guads high. I need to have it like a model that is created in the med or the wed?

Re: Quick jump code issue [Re: Tman] #312641
02/25/10 19:03
02/25/10 19:03
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I don't understand, could you please post a screen shot and describe your problem again in other words?


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Quick jump code issue [Re: Superku] #312672
02/25/10 20:45
02/25/10 20:45
Joined: Jan 2004
Posts: 439
G
Gamesaint762 Offline
Senior Member
Gamesaint762  Offline
Senior Member
G

Joined: Jan 2004
Posts: 439
Im working with Tman so here is the screenshot for the level hes talking about. Thanks!



The player runs by pressing forward key. Press space bar and he does jump animation, however when he returns to the ground instead of doing the landing animation and then going into a run he just stops and then glides across terrain. Its as if he never gets back down to the ground.

Last edited by Gamesaint762; 02/25/10 21:35.
Re: Quick jump code issue [Re: Gamesaint762] #312678
02/25/10 21:34
02/25/10 21:34
Joined: Oct 2009
Posts: 60
T
Tman Offline OP
Junior Member
Tman  Offline OP
Junior Member
T

Joined: Oct 2009
Posts: 60
See the bbox is like surrounding the terrain but the terrain is low and the box spreads all the way up high but if you build a model in the wed the bbox or collision points I might say are the model it self it doesn't build a box around the model.
If that makes sense.

Re: Quick jump code issue [Re: Tman] #312685
02/25/10 22:38
02/25/10 22:38
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Ok. I've understood your problem as follows:
You've made a terrain in an extern program (Maya), that is not an A7-terrain but an A7-model. You want it to behave like a terrain.
AFAIK you only have to set(terrain,POLYGON). When "polygon" is set, the model still needs a bounding box. When c_trace/c_move hits the bounding box, then (!) the engine will check the polygonal shape and if there is contact or not. So it's fine if the bbox is a little bit bigger than the model itself.

Here is a code that I've written some days ago for someone else, so I know that it works (you may test the current model/ situation with it):

Click to reveal..

Quote:
action player_walk() {
var anim_percent = 0;
var grounddist, key_space_released = 0;
VECTOR speed,temp;
vec_set(speed,nullvector);
wait(1);
vec_set(temp,vector(-15,-15,-20)); // die bounding box setzen
vec_scale(temp,my.scale_x); //falls der spieler im level eine andere größe als 1 hat
vec_set(my.min_x,temp);

vec_set(temp,vector(15,15,20)); // die bounding box setzen
vec_scale(temp,my.scale_x); //falls der spieler im level eine andere größe als 1 hat
vec_set(my.max_x,temp);
my.z += 232;

while(1) {

if(!key_space) { key_space_released = 1; } // endlose Sprungwiederholung bei gedrückter Taste verhindern

if(key_a || key_d) {
my.pan = 180*key_a;
anim_percent += 8*time_step;
ent_animate(me, "run", anim_percent, ANM_CYCLE);
}
else {
anim_percent += 4*time_step;
ent_animate(me, "stand", anim_percent, ANM_CYCLE);
}

speed.x += (45*(key_d-key_a)-speed.x)/3*time_step; // sanftes beschleunigen

grounddist = c_trace(my.x,vector(my.x,my.y,my.z-150),IGNORE_ME | USE_BOX);
grounddist = clamp(grounddist+150*(!trace_hit),-5,150);


if(grounddist < 10 && speed.z <= 0) {

my.z -= grounddist-5;
speed.z = 0;
if(key_space && key_space_released) {
speed.z = 50;
}
}
else { speed.z += maxv((-60-speed.z)/5,-7)*time_step; }



c_move(my,nullvector, vector(speed.x*time_step,0,speed.z*time_step),GLIDE);


//Cameraposition
camera.x = 100+my.x;
camera.y = -2500;
camera.z = 400+my.z;
camera.pan = 90;
camera.tilt = -5;
wait(1);
}
}


Next, try using the polygon flag in trace_mode (I've never used it before, pls check the manual).
Then try it with a normal A7-terrain from MED.


EDIT: I'm not sure what your code should do:
Code:
// adjust entity to the ground height, using a downwards trace
		if(c_trace(my.x,vector(my.x,my.y,my.z-5000),IGNORE_PASSABLE|IGNORE_ME) > 0)
		dist_down= my.z + vFeet.z - hit.z; // always place player's feet on the ground
		else
		[b]dist_down = 0;[/b]
		
	   
	   if((dist_down > 0))
		{
		 	
		 dist_down = [b]clamp(dist_down,100,accelerate(speed_down,-nc_gravity * time_step,0.1));[/b]
}



The limits in clamp are -,+ not +,- if I read your code right.
Then why do you set down_dist = 0; ? (I did not spend much time on understanding it, though)

Have you tested the code with block geometry?

Then, try if(down_dist > 5) { ... }.

Last edited by Superku; 02/25/10 22:43.

"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Quick jump code issue [Re: Superku] #312777
02/26/10 13:58
02/26/10 13:58
Joined: Jan 2004
Posts: 439
G
Gamesaint762 Offline
Senior Member
Gamesaint762  Offline
Senior Member
G

Joined: Jan 2004
Posts: 439
The code we are currently using works fine with blocks.. Seems strange that he runs and collision is fine when standing but not after jumping? Strange...

Re: Quick jump code issue [Re: Gamesaint762] #312795
02/26/10 14:23
02/26/10 14:23
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Please read my last post again and test the points that I've mentioned.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Page 1 of 2 1 2

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