Collisions

Blitz3D Forums/Blitz3D Beginners Area/Collisions

Moraldi(Posted 2006) [#1]
How can I disable collisions temporarily. Imagine my character "dying" after a collision jumping to a random direction, but during this jumping I don't want to have Blitz3D stop this sequence because of a new collision...
Thanks!


b32(Posted 2006) [#2]
You could temporally change the entities EntityType, or maybe look at ResetMesh.


Moraldi(Posted 2006) [#3]
I only tried the ResetEntity command (not ResetMesh) but it seems that in this way I changed the EntityRadius too and this is a problem.
I should say that your solution of changing for a while the EntityType is smart and simple. I'll try it!
Thanks


D4NM4N(Posted 2006) [#4]
cant you not just set the entitytype to 0 then set it back when the character is alive again


Moraldi(Posted 2006) [#5]
Well, there are some problems if I use both solutions:
a) If I change the entity type to 0 because my "death" sequence stops when the character reaches to the terrain then he will not stop on the terrain. (I am thinking now a death sequence based on time...)
b) If I use the ResetEntity command then Blitz3D forgets the scaling and the entity radius I initiated from the start of the program. (I created my character using the same method of the CreatePlayer function in the castle demo of mak samples)
Finaly I am wondering what we can do when we want to stop the collsion for an individual model and not for the others of the same type?


jfk EO-11110(Posted 2006) [#6]
If you change the entity type of one entity, then you won't affect the other entities.

I doubt the radius was really forgotten. I guess you are repositioning your character before you did an updateworld. In this moment it is still partially under the terrain, due to gravity. if you position it at this height and then turn on collision, it will fall trough the terrain, Was that the problem? Then simply move it AFTER the updateworld. Probably you want to add a little to its Y, to make sure it won't fall trough nomatterwhat.

There is an additional way to temporarily disable collision: If you use HideEntity, it will also be inactive until you ShowEntity it again.


Moraldi(Posted 2006) [#7]
jfk EO-11110,
After your guess I asked my self if my code is in the right place and in the right time (for example after your post I checked if my character is being positioned before an updateworld command or not. Realy what is the right sequence?). I 'll checkit out having the rest of your guidlines in my mind.
Thanks!


b32(Posted 2006) [#8]
How are your collisions set up ? Maybe you could change the type to say 5 when the death sequence is started, and then check collisions from type 5 to the terrain ?


Boiled Sweets(Posted 2006) [#9]
HideEntity!

This is what we do...

HideEntity g_game_player
PositionEntity g_game_player, x * 4, y * 4, z * 4
showEntity g_game_player


This allows us to position a player (passing thru walls etc). OR even clear the collisions and reset them up again, we do this too...

Function map_set_collisions(state$)

	Select state$
		Case "on"

   		Collisions g_game_collision_type_player, g_game_collision_type_exit,3,2       
	
			Collisions g_game_collision_type_player, g_game_collision_type_key_red, 3, 20
			Collisions g_game_collision_type_player, g_game_collision_type_key_green, 3, 21
			Collisions g_game_collision_type_player, g_game_collision_type_key_blue, 3, 22
			Collisions g_game_collision_type_player, g_game_collision_type_key_yellow, 3, 23
			Collisions g_game_collision_type_player, g_game_collision_type_key_cyan, 3, 20
			Collisions g_game_collision_type_player, g_game_collision_type_key_orange, 3, 21
			Collisions g_game_collision_type_player, g_game_collision_type_key_purple, 3, 22
			Collisions g_game_collision_type_player, g_game_collision_type_key_black, 3, 23

			Collisions g_game_collision_type_player, g_game_collision_type_key_decryption, 3, 24
	
			Collisions g_game_collision_type_player, g_game_collision_type_door_red, 3, 30
			Collisions g_game_collision_type_player, g_game_collision_type_door_green, 3, 31
			Collisions g_game_collision_type_player, g_game_collision_type_door_blue, 3, 32
			Collisions g_game_collision_type_player, g_game_collision_type_door_yellow, 3, 33
			Collisions g_game_collision_type_player, g_game_collision_type_door_cyan, 3, 30
			Collisions g_game_collision_type_player, g_game_collision_type_door_orange, 3, 31
			Collisions g_game_collision_type_player, g_game_collision_type_door_purple, 3, 32
			Collisions g_game_collision_type_player, g_game_collision_type_door_black, 3, 33

			Collisions g_game_collision_type_player, g_game_collision_type_timebomb, 3, 2
			Collisions g_game_collision_type_player, g_game_collision_type_fuelpod, 3, 2
			Collisions g_game_collision_type_player, g_game_collision_type_teleport, 3, 2
			Collisions g_game_collision_type_player, g_game_collision_type_teleport_trigger, 3, 2
			Collisions g_game_collision_type_player, g_game_collision_type_gas_cloud, 3, 2
			Collisions g_game_collision_type_player, g_game_collision_type_gas_cloud_trigger, 3, 2
			Collisions g_game_collision_type_player, g_game_collision_type_gas_mask, 3, 2

			Collisions g_game_collision_type_player, g_game_collision_type_unstable, 3, 2

			Collisions g_game_collision_type_player, g_game_collision_type_bridge, 3, 2
			Collisions g_game_collision_type_player, g_game_collision_type_bridge_trigger, 3, 2

			Collisions g_game_collision_type_player, 99, 3, 2 ;???????????
	
			Collisions g_game_collision_type_player, g_game_collision_type_timecap, 3, 2

			Collisions g_game_collision_type_player, g_game_collision_type_trapdoor, 3, 2
			Collisions g_game_collision_type_player, g_game_collision_type_trapdoor_exit, 3, 2
			Collisions g_game_collision_type_player, g_game_collision_type_trapdoor_trigger, 3, 2

	;		Collisions g_game_collision_type_player, g_game_collision_type_plank, 2, 2
		

		Case "off"
			ClearCollisions

	End Select
	
   Collisions g_game_collision_type_player,g_game_collision_type_brick,3,2    
	
End Function




Moraldi(Posted 2006) [#10]
My collision setup is (BONGO is the player character):

Collisions OBJECTTYPE_BONGO, OBJECTTYPE_TERRAIN, 2, 3
Collisions OBJECTTYPE_BONGO, OBJECTTYPE_ENEMY, 2, 2
Collisions OBJECTTYPE_ENEMY, OBJECTTYPE_TERRAIN, 2, 3

During this forum thread (and of course with your help) I have concluded to this:
I added an "imortal type" like this:

Collisions OBJECTTYPE_IMORTAL, OBJECTTYPE_TERRAIN, 2, 2

When BONGO character must not be involved in collision with the enemy but still has to stop on the ground I simply change the BONGO character type to this:

EntityType bongo_entity, OBJECTTYPE_IMORTAL

and after the death sequence I set the type again to

EntityType bongo_entity, OBJECTTYPE_BONGO

Boiled Sweets:
Can I use a map_set_collisions function within the main loop? I mean, is it matter of execution speed?