2 registered members (Ayumi, 1 invisible),
584
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Simple gravity!
[Re: Pr0gr4mm3r]
#212775
06/24/08 04:31
06/24/08 04:31
|
Joined: Apr 2007
Posts: 582 Germany
Poison
User
|
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 : >>LINK<<
Everything is possible, just Do it!
|
|
|
Simple gravity!
[Re: Pr0gr4mm3r]
#212974
06/25/08 07:18
06/25/08 07:18
|
Joined: Apr 2006
Posts: 159 Latvija
Arrovs
Member
|
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
MDMDFSS
Member
|
Member
Joined: Jul 2008
Posts: 191
|
|
|
|
Re: Simple gravity!
[Re: MDMDFSS]
#221593
08/15/08 02:22
08/15/08 02:22
|
Joined: Oct 2004
Posts: 1,655
testDummy
Serious User
|
Serious User
Joined: Oct 2004
Posts: 1,655
|
Arrovs segment partially endorsed. 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.)
/*
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
|
|
|
|