Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Martin_HH, TipmyPip), 1,279 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
squik, AemStones, LucasJoshua, Baklazhan, Hanky27
19060 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Adding player Physics [Re: Rhuarc] #22762
02/06/04 05:47
02/06/04 05:47
Joined: Oct 2002
Posts: 119
Whirabomber Offline
Member
Whirabomber  Offline
Member

Joined: Oct 2002
Posts: 119
You are right, the entity does seem to sink into the ground, so a demo would allow conetic to see the effect (affect?). Maybe I'll code a short demo with toggleable move methods - c_move, ent_move, trace, and absolute vector.

To use trace to simulate gravity:

Code:


air = trace(my.x, temp.x); // assumes temp set up as above
if (air > 0)
{
velocity.z += gravity.z * time; // gravity.z is acceleration, so calc velocity at time, velocity is cumulative
// velocity is also good to calc damage from fall as speed kills when combined with a sudden stop
dist_moved.z = velocity.z * time; // how much distance would this velocity cover in this ammount of time
}
- or -
air = trace(my.x, temp.x);
if (air > 0)
{
my_time += time; // accumulate time since start of fall
dist_moved.z = gravity.z * my_time * my_time; // d = a * t^2 or d = a * t * t
}
else
{
my_time = 0; // no falling, so don't accumulate time, and reset my_time to 0
}




If you have something that doesn't fall through the floor partially, this code *should* do the 'falling' part of things without using the internal 3dgs physics engine.

Re: Adding player Physics [Re: Whirabomber] #22763
02/06/04 08:13
02/06/04 08:13
Joined: Jan 2004
Posts: 180
D
Death_By_Games Offline OP
Member
Death_By_Games  Offline OP
Member
D

Joined: Jan 2004
Posts: 180
Ok, but where do i add it? at the end of Player_walk?


If You Program Are You Making Games? Or Is It The World That Makes The Game? Or The Models?? Oh Well... -------------------------------------------------- Im trying to make a game...please help me
Re: Adding player Physics [Re: Death_By_Games] #22764
02/06/04 08:37
02/06/04 08:37
Joined: Jan 2004
Posts: 180
D
Death_By_Games Offline OP
Member
Death_By_Games  Offline OP
Member
D

Joined: Jan 2004
Posts: 180
Sweet nvm i got it working!!! thanx to all who helped me!!


If You Program Are You Making Games? Or Is It The World That Makes The Game? Or The Models?? Oh Well... -------------------------------------------------- Im trying to make a game...please help me
Re: Adding player Physics [Re: Death_By_Games] #22765
02/08/04 04:49
02/08/04 04:49
Joined: Oct 2002
Posts: 119
Whirabomber Offline
Member
Whirabomber  Offline
Member

Joined: Oct 2002
Posts: 119
Congrats!

Just in case, here is some code from the manual that appears to address the floor sinking issue:

Code:


var friction;

action move_me
{
while (1)
{
force.PAN = -10 * KEY_FORCE.X; // calculate rotation force
my.SKILL14 = TIME*force.PAN + max(1-TIME*0.7,0)*my.SKILL14; // rotation speed
my.PAN += TIME * my.SKILL14; // rotate the player

vec_set(temp,my.x);
temp.z -= 4000; // calculate a position 4000 quants below the player
// set a trace mode for using the player's hull, and detecting map entities and level surfaces only
trace_mode = ignore_me+ignore_sprites+IGNORE_MODELS+USE_BOX;
result = trace(my.x,temp); // subtract vertical distance to ground

if (RESULT > 5) // in the air?
{
force.X = 0; // no pushing force
force.Y = 0;
force.Z = -5; // gravity force
friction = 0.1; // air friction
}
else // on or near ground
{
force.X = 10 * KEY_FORCE.Y; // translation force
force.Y = 0;
force.Z = -0.5 * RESULT; // ground elasticity
friction = 0.7; // ground friction
}

my.SKILL11 = TIME*force.X + max(1-TIME*friction,0)*my.SKILL11; // calculate ahead speed
my.SKILL13 = TIME*force.Z + max(1-TIME*friction,0)*my.SKILL13; // calculate vertical speed
dist.X = TIME * my.SKILL11; // distance ahead
dist.y = 0;
dist.Z = TIME * my.SKILL13; // distance down

move_mode = ignore_passable + glide;
ent_MOVE(dist,nullvector); // move the player
move_view(); // move the camera
wait(1);
}
}



Note the "if (result > 5)" statement which lowers the fall 'force' to 0.5 to prevent the one frame where the entity sinks through the floor. I am in the belief that 3DGS does a move, collision check, move collision check type deal.

Page 2 of 2 1 2

Moderated by  HeelX, Spirit 

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