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
1 registered members (Ayumi), 900 guests, and 4 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
Page 1 of 3 1 2 3
collision system #210698
06/12/08 11:47
06/12/08 11:47
Joined: Feb 2007
Posts: 353
A
amy Offline OP
Senior Member
amy  Offline OP
Senior Member
A

Joined: Feb 2007
Posts: 353
http://www.conitec.net/beta/ac_move.htm

So far so good but could you also add gravity to this movement example? The troubles with movement start with gravity for me. With problems i mean jittering, getting stuck and not being able to prevent gliding up steep slopes.

Compared to some other engines I find the Gamestudio collision system hard to use. Why do I have to use c_trace and canīt simply push the ellipsoid around with gravity and everything?

It would be nice if not only ellipsoids but also other collision shapes were available.

Re: collision system [Re: amy] #210711
06/12/08 12:35
06/12/08 12:35
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
where's your problem? the engine has a physics system which does collision detection. furthermore you can apply your own forces which accelerate an entity and use the c_... functions manually. there's no such problems as getting stuck or not being able to walk up stairs when you use them properly.

Re: collision system [Re: Joey] #210717
06/12/08 12:49
06/12/08 12:49
Joined: Feb 2007
Posts: 353
A
amy Offline OP
Senior Member
amy  Offline OP
Senior Member
A

Joined: Feb 2007
Posts: 353
Please show me a simple movement script like on that manual page with gravity. Like I said, I find the Gamestudio collision system hard to use right compared to the ones of some other engines. Itīs not clear how to use it properly.

My own try kind of works but I need the floordistance because otherwise i get stuck on some concave floor edges. The floordistance makes it impossible to prevent running up very steep slopes though. I think it would be easiest if it simply were possible always apply gravity to the ellipsoid but for that the collision system doesnīt seem to be robust enough.

Code:
action movement()
{
	var speed = 0;
	var speedz = 0;
	var friction = 0.75;
	var frictionz = 0.1;
	var floordistance = 2;
	var move
	var movez;
	
	my.min_z += floordistance;
	
	while(1)
	{
		result = c_trace(my.x, vector(my.x, my.y, my.z - 5000), IGNORE_ME | IGNORE_PASSABLE | USE_BOX);
		if(result > floordistance)
		{
			movez = accelerate(speedz, -10, frictionz);
		}
		else
		{
			speedz = 0;
			movez = floordistance - result;
		}
		
		my.pan += (key_a - key_d) * 10 * time_step; 
		move = accelerate(speed, (key_w - key_s) * 10, friction);
		result = c_move(my, vector(move, 0, movez), nullvector, IGNORE_PASSABLE | GLIDE); 
		
		wait(1);	
	}
}


Re: collision system [Re: amy] #210721
06/12/08 13:38
06/12/08 13:38
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
Quote:
but for that the collision system doesnīt seem to be robust enough


it is. there are thousands of working movement scripts around. the simple truth is that your code is wrong somewhere.

Code:
my.min_z += floordistance;

modifies the bounding box. i see no sense in this statement at all. try to use c_updatehull instead.

also you should check return from trace being equal to zero, because that means that nothing is hit.

like plenty of people before you you're assuming that the engine is wrong somewhere before looking at your own code. i see why your entity gets stuck on slopes but you haven't asked a question like "why does my movement code get stuck on slopes"? that's my problem. and that is yours. i'd advice you to post a question in the beginner's section or somewhere...

joey.

Re: collision system [Re: Joey] #210724
06/12/08 13:46
06/12/08 13:46
Joined: Feb 2007
Posts: 353
A
amy Offline OP
Senior Member
amy  Offline OP
Senior Member
A

Joined: Feb 2007
Posts: 353
The simple truth is that you didnīt try to understand my script. I modify the bounding box because if the ellipsoid touches the ground i get sticking problems. Because of this modification I donīt have to check if the c_trace result is bigger than zero but bigger than the amount of the modification.

None of the movement scripts I came across works flawlessly. I donīt think i am too picky. Getting stuck should never happen!

I would be very grateful if someone would add gravity in the correct way to the example on that manual page. It sounds like every idiot except me can do it so it shouldnīt be that hard! smile

Re: collision system [Re: amy] #210727
06/12/08 14:24
06/12/08 14:24
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
The movement example in the link to the manual contains already gravity, quite similar to that in yours.

Quote:
The floordistance makes it impossible to prevent running up very steep slopes though. I think it would be easiest if it simply were possible always apply gravity to the ellipsoid but for that the collision system doesnīt seem to be robust enough.


What you are asking for is actually a physics system.

Instead, you could add to your code something like:
- get the normal of the ground,
- if it is too steep,
- push the entity in direction of the normal.

Re: collision system [Re: amy] #210729
06/12/08 14:30
06/12/08 14:30
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
of course, you're modyfing your bounding box because of sticking problems. that does not make sense at all because why should a smaller bounding box _not_ stick with your faulty code?
the point is that you're checking the height for numbers higher than two. but this has nothing to do with the collision ellipsoid.

Quote:
I donīt think i am too picky.


well, you are. and i think you're picky with the people who want to help you. since i'm not having your problems i won't make any further efforts to help you. good luck...

Re: collision system [Re: Joey] #210732
06/12/08 14:40
06/12/08 14:40
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Originally Posted By: Joey
of course, you're modyfing your bounding box because of sticking problems. that does not make sense at all because why should a smaller bounding box _not_ stick with your faulty code?

That's not true. Read the discussion of clone45, damocles and jcl. It indeed makes much sense to let the box _not_ touch the ground, because it prevents the collision system from unnecessary computings.

Re: collision system [Re: Joey] #210733
06/12/08 14:41
06/12/08 14:41
Joined: Feb 2007
Posts: 353
A
amy Offline OP
Senior Member
amy  Offline OP
Senior Member
A

Joined: Feb 2007
Posts: 353
Quote:
The movement example in the link to the manual contains already gravity, quite similar to that in yours.
The example on the manual page doesnīt have real gravity. It sets the entity exactly to the ground every frame and thus avoids all problems.

Quote:
that does not make sense at all because why should a smaller bounding box _not_ stick with your faulty code?
My method solves the sticking problem because the c_move ellipsoid doesnīt touch the ground anymore but the disadvantage is that it makes it possible to climb slopes up to 89° and there is no obvious way to prevent that.

Quote:
and i think you're picky with the people who want to help you.
You didnīt try to help me but were very condescending right from the beginning.



Re: collision system [Re: amy] #210736
06/12/08 14:51
06/12/08 14:51
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Quote:
The example on the manual page doesnīt have real gravity. It sets the entity exactly to the ground every frame


Ah, okay, I see. You're right.

Page 1 of 3 1 2 3

Moderated by  aztec, Inestical, Matt_Coles, Tobias 

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