Gamestudio Links
Zorro Links
Newest Posts
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 (Ayumi, 1 invisible), 584 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Simple gravity! #212768
06/24/08 03:20
06/24/08 03:20
Joined: Jul 2005
Posts: 72
Pr0gr4mm3r Offline OP
Junior Member
Pr0gr4mm3r  Offline OP
Junior Member

Joined: Jul 2005
Posts: 72
Please as I put gravity in this code, the player this floating, This is the code of the player;

////////////////////////////////////////////
action players_code
{
player = my;
my.invisible = on;
while (1)
{
c_move (my, vector(10 * (key_w - key_s) * time_step, 6 * (key_a - key_d) * time_step, 0), nullvector, glide);
vec_set (camera.x, player.x);
camera.z += 30;
camera.pan -= 5 * mouse_force.x * time_step;
camera.tilt += 3 * mouse_force.y * time_step;
player.pan = camera.pan;
wait (1);
}
}
////////////////////////////////////////////

put the code piece so that the player is fixed in the floor. Thank you!


my site of 3d gamestudio: http://byteseartes.sitesled.com
Re: Simple gravity! [Re: Pr0gr4mm3r] #212775
06/24/08 04:31
06/24/08 04:31
Joined: Apr 2007
Posts: 582
Germany
Poison Offline
User
Poison  Offline
User

Joined: Apr 2007
Posts: 582
Germany
look for c_move in the online-manual thre is an example about gravity.
or just use this link smile :
>>LINK<<


Everything is possible, just Do it!
Re: Simple gravity! [Re: Poison] #212850
06/24/08 17:02
06/24/08 17:02
Joined: May 2006
Posts: 90
England
TigerTao Offline
Junior Member
TigerTao  Offline
Junior Member

Joined: May 2006
Posts: 90
England
BAM!

var move_result;

action players_code
{
player = my;
my.invisible = on;
while (1)
{
move_result = c_trace(my,vector(my.x,my.y,m.z - 4000) use_box | ignore_me | ignore_passable;

c_move (my, vector(10 * (key_w - key_s) * time_step, 6 * (key_a - key_d) * time_step, 0), nullvector, glide);

if(move_result != 0)
{
my.z -= move_result;
}

vec_set (camera.x, player.x);
camera.z += 30;
camera.pan -= 5 * mouse_force.x * time_step;
camera.tilt += 3 * mouse_force.y * time_step;
player.pan = camera.pan;
wait (1);
}
}

Re: Simple gravity! [Re: TigerTao] #212903
06/24/08 22:56
06/24/08 22:56
Joined: Jul 2005
Posts: 72
Pr0gr4mm3r Offline OP
Junior Member
Pr0gr4mm3r  Offline OP
Junior Member

Joined: Jul 2005
Posts: 72
Thank you very much friends, good luck to all!


my site of 3d gamestudio: http://byteseartes.sitesled.com
Simple gravity! [Re: Pr0gr4mm3r] #212974
06/25/08 07:18
06/25/08 07:18
Joined: Apr 2006
Posts: 159
Latvija
Arrovs Offline
Member
Arrovs  Offline
Member

Joined: Apr 2006
Posts: 159
Latvija
Not too good way for gravity!
Here can put on two ways to get nice gravity!

First is to use c_move absolut z axe for falling with simple formule --> a=gt^2/2
but then only minuss ir that when you will ease downward even from 5 degrees slope on ground.

If you will use this formule together with c_trace then again minuss is that when you will not slope down even from 70 degrees.

Ok - no more theorees.

Here is example:

var gravitacija=9.8;

function gravitate
{
result = c_trace(vector(my.x,my.y,my.z),vector(my.x,my.y,my.z - 40000),ignore_me+use_box);

my.speks_z =((gravitacija * sekundes^2)/2);
my.kustiba_z =(-1*my.speks_z);//
if(result=<1)
{
sekundes=0.4;//this keep some g force even on ground too and dont let sum secunds after coming to ground.
}
}


function main_hero_function
{
sekundes+=time_step/16;//16 frames in second then 1 second is 16 timesteps/16!!
....
c_move(my,vector(my.kustiba_x,my.kustiba_y,0),vector(0,0,my.kustiba_z),use_box + glide + activate_trigger);
}

P.S. if you wil try something with disable_z_glide or else - you can get really really comfortable gravity with vertical friction.

Last edited by Arrovs; 06/25/08 12:00.

Arrovs once will publish game
Re: Simple gravity! [Re: Arrovs] #221556
08/14/08 18:14
08/14/08 18:14
Joined: Jul 2008
Posts: 191
M
MDMDFSS Offline
Member
MDMDFSS  Offline
Member
M

Joined: Jul 2008
Posts: 191
don`t work

Re: Simple gravity! [Re: MDMDFSS] #221593
08/15/08 02:22
08/15/08 02:22
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
Arrovs segment partially endorsed.

Quote:
don't work

It's all in the theory.
(opt in: bullsh!t phrases)
For those that smell like defeatists, it might not.
(Including self among that number, many a day.)
Code:
/*
1. c_move fall via abs z 
---a=gt^2/2 
---accel = (gravity*pow(time, 2)) / 2  
2.  don't work
*/
var ct_nEntityHt = 0;
var ct_nGravHt= 2;
var ct_nResult = 0;
var mv_v1[3];
var mv_v2[3];
var ph_nGravity = 9.8;


// temps (fire them as necessary)
var n1 = 0;
var n2 = 0;
var v1[3];
var v2[3];

define _spC, skill70;
define _spX, skill70;
defien _spY, skill71;
define _spZ, skill72;
define _ph_nTm, skill73;
define _new, flag8;

function phf_step1() {
	my._ph_nTm += time_step / 16;	// down with clown pharmacists
	ct_nEntityHt = my.max_z - my.min_z;
}
function phf_gravity() {
	v1.x = my.x;
	v1.y = my.y;
	// trace down dist is multiple of entity height
	v1.z = my.z - (ct_nEntityHt * ct_nGravHt);	// no clowns please

	ct_nResult = c_trace(my.x, v1, IGNORE_ME | USE_BOX);
	my._spZ = -((ph_nGravity * pow(my._ph_nTm, 2)) / 2);	// parenthesis are like ogres (a=gt^2/2)?
	
	if (ct_nResult < 1) {	// ogres smell better than 'my' code conventions
		// fudge time?
		my._ph_nTm = 0.4;
	}
}
function phf_mv1() {
	phf_step1();
	phf_gravity1();
	
	mv_v1.x = my._spX; 
	mv_v1.y = my._spY; 	
	mv_v1.z = 0;
	
	mv_v2.x = 0; 
	mv_v2.y = 0; 	
	mv_v2.z = my._spZ;
	
	ct_nResult = c_move(me, mv_v1, mv_v2, USE_BOX | GLIDE | ACTIVATE_TRIGGER);
}
// don't bother
// that don't work either :)
// file pseudo-auto generated from src: Arrovs Komanda
// If reading this with jumbo Courier font, or cousin thereof, give up expediently (or like NOW, even).
// prev line should fit in window at 1024x768


Re: Simple gravity! [Re: testDummy] #221723
08/15/08 19:18
08/15/08 19:18
Joined: May 2006
Posts: 90
England
TigerTao Offline
Junior Member
TigerTao  Offline
Junior Member

Joined: May 2006
Posts: 90
England
"// temps (fire them as necessary)"

This was so funny that I got all serious about why it should be funny.


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