Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 959 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Moving model stuck with non-move model #270045
06/05/09 17:22
06/05/09 17:22
Joined: Oct 2003
Posts: 827
22�21'24"N 114�07'30"E
Frederick_Lim Offline OP
User
Frederick_Lim  Offline OP
User

Joined: Oct 2003
Posts: 827
22�21'24"N 114�07'30"E
I have this question for long time, but not able to get rid of it.

What is the best approach to handle collision when moving model collide with a non-moving model? Why model collision is not as smooth as glide over map enitity?

I use c_move, c_rotate for movement.

Re: Moving model stuck with non-move model [Re: Frederick_Lim] #270060
06/05/09 19:51
06/05/09 19:51
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline
Expert
mpdeveloper_B  Offline
Expert

Joined: Feb 2006
Posts: 2,185
In PreVa, we counteracted this by using this code:

Code:
entity* ent1;

function phys_move(e1, &reldist, &absdist, mode_)
{
	var ab;
	ent1 = e1;
	ab = c_move (ent1, reldist, absdist, mode_);
	if (ab <= 0)
	{
		vec_diff (temp, target, my.x);
		vec_inverse (temp);
		vec_normalize(temp, 0.2);
		if (you) { if (you.push >= my.push) { vec_add(my.x,temp); } } //move us away from you
		else { vec_add(my.x,temp); }
	}
}


It could be modified for A7 if any code is different there. All you have to do is replace all your c_move instructions with phys_move, this code makes it where you can use actual pan, tilt, and roll. It also makes it where you can do some light physics with it (pushing boxes, etc).


- aka Manslayer101
Re: Moving model stuck with non-move model [Re: mpdeveloper_B] #270088
06/06/09 04:15
06/06/09 04:15
Joined: Oct 2003
Posts: 827
22�21'24"N 114�07'30"E
Frederick_Lim Offline OP
User
Frederick_Lim  Offline OP
User

Joined: Oct 2003
Posts: 827
22�21'24"N 114�07'30"E
My player entity is a vechicle. Is it good for player if user control entity is collide to a station entity the player entity automatic turn left or right and move to avoid the station entity? Will this control too frustrate to player?

Re: Moving model stuck with non-move model [Re: Frederick_Lim] #270089
06/06/09 04:20
06/06/09 04:20
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline
Expert
mpdeveloper_B  Offline
Expert

Joined: Feb 2006
Posts: 2,185
just try replacing your c_move with it and see if it's what you need, it keeps you from being stuck in stuff. For instance:

c_move (me, vector(5,0,0), nullvector, glide);

would be changed to:

phys_move (me, vector(5,0,0), nullvector, glide);

so all you need to do is copy that code to near the top of your lines in your main script and change the red part in your c_move functions:

c_move (me, vector(5,0,0), nullvector, glide);

the phys_move function I gave you is a replacement for c_move, it keeps you from getting stuck in walls, nothing more.

It would be helpful if you would post the code in question. smile


- aka Manslayer101
Re: Moving model stuck with non-move model [Re: Frederick_Lim] #270091
06/06/09 05:14
06/06/09 05:14
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Originally Posted By: Frederick_Lim
What is the best approach to handle collision when moving model collide with a non-moving model? Why model collision is not as smooth as glide over map enitity?

I use c_move, c_rotate for movement.

Reason is that by default, models use non polygonal collision detection and map entities use polygonal collision detection. For collision to glide along a model just like a map entity, set the POLYGON flag for that model in WED, or in script.

Then models and map entities behave exactly the same on collision, at least in my projects there is no difference.

Re: Moving model stuck with non-move model [Re: Tobias] #270107
06/06/09 10:28
06/06/09 10:28
Joined: Oct 2003
Posts: 827
22�21'24"N 114�07'30"E
Frederick_Lim Offline OP
User
Frederick_Lim  Offline OP
User

Joined: Oct 2003
Posts: 827
22�21'24"N 114�07'30"E
mpdeveloper_B
Thanks for your code, but the code does not work well with my movement code, as I am using down force in relative movement as well. But that insprire me some idea to use later. I also found c_move also return bounce vector, maybe I will base on your code to make my own bounce effect.

Tobias
Yeah after set the POLYGON flag the collision behaves like map entity now, thanks for the hint.

Thank you all smile


Moderated by  old_bill, 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