Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 838 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
free-fall movement #285158
08/17/09 12:47
08/17/09 12:47
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
boyax Offline OP
Member
boyax  Offline OP
Member

Joined: Mar 2009
Posts: 276
Cebu City, Philippines
I'm having problem moving my player entity in free-fall...
In such case also I need to adjust the player tilt= -40 instead of moving with it directly straight to its z-axis it moves back..
some illustration:


The correct movement is the dashed line and not to move down backwards (straight line)..

the code i've used is just:
Code:
c_move(player, vector(0,0,myVerticalAccel), nullvector, IGNORE_PASSABLE | GLIDE);
player.tilt = -40;
player.tilt = clamp( player.tilt, -90,90 );



any way idea how I could solve it? Thanks

Re: free-fall movement [Re: boyax] #285159
08/17/09 12:55
08/17/09 12:55
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
c_move(pointer, vector_in_own_coord_system, vector_in_world_coord_system, flags);


you used the own coords/angles to move, instead of the world angles. So he moves the way he is looking at. ^^

vector(0,0,myVerticalAccel), nullvector,

just change them to:

nullvector, vector(0,0,myVerticalAccel),

Last edited by Espér; 08/17/09 12:56.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: free-fall movement [Re: boyax] #285160
08/17/09 12:56
08/17/09 12:56
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Maybe, I understand your problem wrong, but here is my soltion:

Exchange 'nullvector' with 'vector(0,0,myVerticalAccel)', because the first vector is relative to the entity's angles and the second is absolut, means relative to the worlds angles.

c_move(player, nullvector, vector(0,0,myVerticalAccel), IGNORE_PASSABLE | GLIDE);


From the manual:
Quote:
c_move(ENTITY* entity,VECTOR* reldist,VECTOR* absdist,var mode)
Moves an entity over a certain distance while performing collision detection, triggering collision events, and gliding along obstacles.

The first vector reldist gives a relative distance and direction in rotated entity coordinates, i.e. the direction that the entity is facing. The second vector absdist gives an absolute distance and direction in world coordinates.

http://www.conitec.net/beta/ac_move.htm

Re: free-fall movement [Re: Pappenheimer] #285165
08/17/09 13:26
08/17/09 13:26
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
boyax Offline OP
Member
boyax  Offline OP
Member

Joined: Mar 2009
Posts: 276
Cebu City, Philippines
Yay! got it interchanged... Thanks for the help. smile

Re: free-fall movement [Re: boyax] #285787
08/20/09 07:00
08/20/09 07:00
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
boyax Offline OP
Member
boyax  Offline OP
Member

Joined: Mar 2009
Posts: 276
Cebu City, Philippines
I still have problem with this...

My movement is govern that the everytime I press cursor up (key_cuu) it will move up (feels like flying), then, the mouse_force.x would change the pan/roll of the player.... but my problem now is that, when the player is on the ground and moves the mouse (left/right), the player moves back.. I don't know why? I think there should be an external force that go against the movement when in the ground.



Here's the player's action code:
Code:
action act_player()
{
	var myVerticalAccel = 0.0005;
	var dist_down = 0;		
		
	player = my;
	vec_for_min(vFeet,player); // vFeet.z = distance from player origin to lowest vertex
	
	while(1)	
	{		
		if( player.z > 30000)  //height limit
		{
			player.z = 30000;			
			myVerticalAccel = 0;
		}
		
		newValue = 0;		
		
		if(mouse_left || key_cuu)
		{
			//temp += 0.01;
			newValue += 40;			
		}
		else if(key_cud)
		{
			//temp -= 0.01;			
		}				
		
		if (c_trace(player.x,vector(player.x,player.y,player.z-5000),IGNORE_ME | IGNORE_PASSABLE | USE_BOX) > 0)
		{
   		  dist_down = player.z + vFeet.z - target.z; // get distance between player's feet and the ground
		}
		else
		{
			dist_down = 0;
		}
	
		if(dist_down <= 0)
		{								
			myVerticalAccel = 3;
		}
				
		myVerticalAccel -= 0.4;
				
		SpeedBuffer(); //calculate constant speed, just put it on buffer
		speed = totalSpeed/30;
			
		if(speed < 2)
		{
			speed = 0;
		}
		
		AverageSpeedBuffer();
		AverageSpeed = totalSpeedAverageSpeed/50;
		///
		speedDifference = speed - AverageSpeed;
		myVerticalAccel += speedDifference/15;
								
		c_move(player, vector(speed,0,myVerticalAccel), nullvector, IGNORE_PASSABLE | GLIDE);
								
		player.tilt = speedDifference*2;
		player.tilt = clamp( player.tilt, -90,90 );	
		
		player.roll = clamp( (player.roll + mouse_force.x * time_step * 15), -50, 50 );		
		player.pan = (player.pan-player.roll*time_step*0.05);
			
		isometric_camera();				
		totalSpeed = 0;
		totalSpeedAverageSpeed = 0;						
		wait(1);
	}
}



Re: free-fall movement [Re: boyax] #285834
08/20/09 14:31
08/20/09 14:31
Joined: Mar 2009
Posts: 276
Cebu City, Philippines
boyax Offline OP
Member
boyax  Offline OP
Member

Joined: Mar 2009
Posts: 276
Cebu City, Philippines
Anyone?


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