Check for collusions, but no slide/stop?
Blitz3D Forums/Blitz3D Beginners Area/Check for collusions, but no slide/stop?
| ||
How can I just check for collisions without having to use it's built in actions? (stop, slide1, slide2) I just want a true or false |
| ||
It depends, between which colliders do you want to check for a collision ? circle -> circle ? circle -> rectangle ? circle -> line ? sphere -> sphere ? sphere -> box ? sphere -> quad ? These calculations can be done easily with maths. Or you could use a combination of a distance check, and if in range, meshintersect. Or you could use colliders and a collision check and destroy the collided collider and recreate it when required (it seems that ResetEntity can be used to disable the collision of a collider during one frame but i have found that it does not always work) Topic on the same subject : http://www.blitzbasic.com/Community/posts.php?topic=98459 |
| ||
I was able to get it to work by doing this- Pseudo code shows ---order of events--- : Set up collision types... Stop, slide, whatever doesn't matter. A=createpivot() Entityradius a,10,50 Position A,startx,starry,startz ;because it won't go where you want it ;Unless you set it's collider flags AFTER you position it inside something. ;turn them off again if necessary later. Entitytype A,blah Cam=createcamera() (whatever) Renderloop: Upobjs Updateworld Renderworld Chkcoll Loop Function updobjs() Position cam,x,y+10,z Position A, entityx(cam),entityy(cam),entityz(cam) End function Function chkcoll() T=countcollisions(a) Debuglog t End function This should give you a hint Simply DON'T make the A a child of the camera. You have to move them either before or after updateworld. You'll have to play with it... It'll work! |
| ||
Don't forget to use lots of Global statements at the top: Global A,x,y,z,T ;(if you need T) Global Cam Happy Hollidays! |
| ||
;gravity If Not (EntityCollided(player,TYPE_WORLD)) If Not(noclip) gravity = gravity * 1.02 MoveEntity(player, 0,-gravity,0) EndIf Else gravity = 0.3 If(noclip) ;This stops sliding etc noclip ResetEntity(player) EndIf EndIf That solved it for me! Thanks abtwat |