Need help to desactivate a collider please

Blitz3D Forums/Blitz3D Beginners Area/Need help to desactivate a collider please

RemiD(Posted 2012) [#1]
Hi, :)

I have read all the posts i can find on the forum about how to desactivate a collider in order to be able to reposition, rerotate it correctly when used as a trigger with a response stop.

This is really something i need to be able to do because combining several colliders sphere and the use of TFormpoint is really powerfull to create "hulls" around a character or a projectile or a weapon and to resposition the entity at the correct place when a collider detects a collision.

I have read on several posts that it is possible to desactivate a collider in several ways, unfortunatly, the only way that i have managed to make work is by deleting the collider and creating a new collider at the correct position, orientation.

See this code for my tries with the others ways :
<-removed erroneous code->

As i have read in others posts of the forums, the others ways to desactivate the collision detection and response for a collider are :
EntityType(Collider,0)
or
ResetEntity(Collider)
or
HideEntity(Collider)
ShowEntity(Collider)

But none of these commands seem to desactivate the collider, try the different "ResetMode" in the code above, you will see what i mean.

Do you have an idea on how to achieve this without having to delete/create the collider each time ?

Thanks,


GfK(Posted 2012) [#2]
As i have read in others posts of the forums, the others ways to desactivate the collision detection and response for a collider are :
EntityType(Collider,0)
or
ResetEntity(Collider)
or
HideEntity(Collider)
ShowEntity(Collider)

Haven't used Blitz3D for years but I'm 99% sure you need to call UpdateWorld between HideEntity and ShowEntity, otherwise Hiding/Showing the entities you don't want collisions on becomes redundant as they're still visible when the next UpdateWorld is called.


RemiD(Posted 2012) [#3]
Thanks for the suggestion, but this produces the same effect.

By tracking its position i can see that the collider is still active and moves up against the wall and then moves forward really fast.


RemiD(Posted 2012) [#4]
From the documentation :

Just use 'ResetEntity' immediately after the positioning command (it can actually be used anywhere between the positioning command and the 'UpdateWorld' command) and the collision data for the entity will be reset, fooling the collision system into thinking that the entity was already at the new position, and had not been moved.

Very useful when you want to teleport game characters and items, for example.



Why ResetEntity() doesn't work ? it is called before updateworld and after the PositionEntity()


RemiD(Posted 2012) [#5]
Finally i have found a way to activate/desactivate the colliders only when i need them by adding 2 functions :

CollidersSet(MeshKind%,OId%) ;creates x colliders (Pivot + EntityRadius) around a mesh depending on it's kind, and sets its state to IsMoving%

CollidersUnSet(MeshKind%,OId%) ;deletes all colliders around a mesh and sets its state to IsStatic%.

This, plus a routine that unsets/sets the collisions groups with their detection mode and response.

This works well.

Ok, next step.

Last edited 2012


RemiD(Posted 2016) [#6]
I still don't understand what is the usefulness of ResetEntity(), however here are 2 examples to demonstrate how to desactivate ellipsoid colliders during one frame (or several frames) (in order to be able to reposition an entity without having its ellipsoid colliders get stuck, or in order to be able to detect a collision but have the ellipsoid colliders go through a collidable)


desactivate ellipsoid colliders during one or several frames then reactivate them (reset ellipsoids, reposition root) : (this does not work!)



desactivate ellipsoid colliders during one or several frames then reactivate them (hide ellipsoids, reposition root, show ellipsoids) :



desactivate ellipsoid colliders during one or several frames then reactivate them (delete ellipsoids, reposition root, recreate ellipsoids) :



RemiD(Posted 2016) [#7]
code examples updated !