A little help with collision?

Blitz3D Forums/Blitz3D Beginners Area/A little help with collision?

Obliteration(Posted 2014) [#1]
Hello, sorry for repeating a same question for three two six four several few times and still can't get the camera (player) collision moving, I've tried but it appear be useless... I am trying make a game that the player walk and run (not important).

The code is below;



I really appreciate your time explaining to me or even correct it. Also I've tried make sound play when click on box (or called gen). When I've click on box, it went No Listener created.

Thank you again for your time reading this.


Rick Nasher(Posted 2014) [#2]
For the basices of collisions/sound I suggest checking these examples/tutorials:
http://jnoodle.com/Blitz3D/

and:
http://jnoodle.com/Blitz3D_1/

For Picking:
http://www.blitzbasic.com/codearcs/codearcs.php?code=3095


RemiD(Posted 2014) [#3]
Some ideas to manage collidables, colliders, collisions :

->for the collidables (the shapes which are static and receive collisions) i use low tris meshes

->for the colliders (the shapes which are turning moving and provoke collisions) i use ellispoids (a pivot + entityradius)
entityradius(pivot,radius#)

->then i put each collidable in a collisions group, and each collider in a collision group : (i use constants to make the code more clear)
const GroupTerrainsP% = 1
const GroupBuildingsP% = 2
const GroupCharactersP% = 3
const GroupCharactersE% = 4
const GroupBulletsE% = 5
EntityType(TerrainCollidable,GroupTerrainsP)
EntityType(BuildingCollidable,GroupBuildingsP)
EntityType(CharacterCollidable,GroupCharactersP)
EntityType(CharacterCollider,GroupCharactersE)
EntityType(BulletCollider,GroupBulletsE)

E represents Ellipsoid (=turning moving ellipsoids)
P represents Polygon (=static low tris meshes)

->then i define the collisions detection and response between the different groups
Collisions(GroupCharactersE,GroupTerrainsP,2,2) ;ellipsoid to polygon, slide
Collisions(GroupCharactersE,GroupBuildingsP,2,2) ;ellipsoid to polygon, slide
Collisions(GroupCharactersE,GroupCharactersE,1,2) ;ellipsoid to ellipsoid, slide
Collisions(GroupBulletsE,GroupCharactersP,2,1) ;ellipsoid to polygon, stop

->then in the mainloop,
I turn move the turningmoving entities (in this case the characters and the bullets) then updateworld(), then if needed, i check if some collisions happened, and if yes i update the state and the orientation and the position of the concerned colliders/entities

->to check if a collision happened, for each collider i use countcollisions(collider) and collisionentity(collider,1)

see these examples :
with dim arrays
http://www.blitzbasic.com/codearcs/codearcs.php?code=3094
with types
http://www.blitzbasic.com/codearcs/codearcs.php?code=3095

or this one : (simpler)
http://www.blitzbasic.com/codearcs/codearcs.php?code=3141


Obliteration(Posted 2014) [#4]
I've had a look at these, thank you.