c_move friction problem with ball and platform

Posted By: Toon

c_move friction problem with ball and platform - 06/11/09 15:38

Is it possible to move a ball over a platfrom in a smooth way? The ball has gravity applyed.

I tryed the code below but it does not run smoothly. It looks like there is a problem with friction between the two models.

Here is my script;

Code:
 
action ball
{
	var ball_move[3];
	
	var ball_gravity;
	
	wait(1);
	
	c_setminmax(me);
	
	while(1)
	{		
		ball_move.x = (key_d - key_a) * 5 * time;
		
		if(trace_hit)
		{
			ball_gravity = 0;
		}
		else
		{
			ball_gravity = -5;
		}
		
		c_move(me,ball_move.x,vector(0,0,ball_gravity*time),glide | ignore_passable);
		
		wait(1);
	}
}

action platform
{
	wait(1);
	
	c_setminmax(me);
}

Posted By: vlau

Re: c_move friction problem with ball and platform - 06/13/09 05:57

You could try to apply gravity only when
the ball is stop moving.
Posted By: Toon

Re: c_move friction problem with ball and platform - 06/16/09 17:08

Thanks for your reaction, i didnt thought of that yet so im going to try it right now smile
Posted By: Toon

Re: c_move friction problem with ball and platform - 06/16/09 17:17

I tryed this but now the ball only comes down when i'm not moving it, so even when it is not on a platform but thanks for your reply anyway smile
Posted By: Pappenheimer

Re: c_move friction problem with ball and platform - 06/16/09 17:37

From the online manual:
http://www.conitec.net/beta/ac_move.htm
Quote:
!! A usual beginner's mistake is extending the entities' bounding box all the way to its feet and then apply gravity for pressing the entity against the ground. This is not only slow due to the permanent collisions with the ground, it will also cause the entity to get stuck in any little crack in the floor, and prevent it from ascending stairs or slopes. Rather, use c_trace for keeping the entities' bounding box at a distance from the ground, and apply gravity only above that distance. See the example below for a simple movement function.

Posted By: vlau

Re: c_move friction problem with ball and platform - 06/17/09 06:37

I'm not sure what you're trying to do, you don't need
to change the value of "ball_gravity" every frame, the
ball model will glide on the ground automatically and
it still move smoothly when it land as I tested with my
latest A7.com

I see that you're still using "time" not "time_step", it may
be the problem of c_move in old A6 version.

Maybe you could try move_friction :

Code:
while(1)
{
    ball_move.x = (key_d - key_a) * 5 * time;
    move_friction = 0;
    c_move(....blah..blah)
    wait(1);
}

© 2024 lite-C Forums