Collisions with MaxB3D/WarnerEngine Module

BlitzMax Forums/BlitzMax Programming/Collisions with MaxB3D/WarnerEngine Module

Captain Wicker (crazy hillbilly)(Posted 2012) [#1]
Does anyone know how to setup collisions with kfprimm's MaxB3D module or Warner's Engine module?

Here is an example of whats happening in my code:
Strict
Import maxb3d.drivers

Graphics 800, 600

Const TYPE_SP1 = 1
Const TYPE_SP2 = 2

Global light:TLight = CreateLight()
Global camera:TCamera = CreateCamera()
SetEntityRotation light, 90, 0, 0

Global sphere1:TMesh = CreateSphere()
SetEntityPosition sphere1, 2.5, 0, 5
SetEntityColor sphere1, 255, 0, 0
SetEntityType sphere1, TYPE_SP1

Global sphere2:TMesh = CreateSphere()
SetEntityPosition sphere2, -2.5, 0, 5
SetEntityColor sphere2, 0, 0, 255
SetEntityType sphere2, TYPE_SP2


While Not KeyHit(KEY_ESCAPE) And Not AppTerminate()

If KeyDown(KEY_LEFT) Then MoveEntity sphere1, -.1, 0, 0
If KeyDown(KEY_RIGHT) Then MoveEntity sphere1, .1, 0, 0



SetCollisions(TYPE_SP1,TYPE_SP2,2,2)
SetCollisions(TYPE_SP2,TYPE_SP1,2,2)

UpdateWorld
RenderWorld
Flip(True)
Wend

1. The spheres have no color after coloring them and 2. Collisions do not work until the sphere is right on top of the other sphere. Can someone please help?

thnx

Last edited 2012


slenkar(Posted 2012) [#2]
you have to set the entityradius


Kryzon(Posted 2012) [#3]
Have you used Blitz3D before? That SetCollisions() command looks very similar to Blitz3D's Collisions command, which makes me think it should only be used to setup collisions.

Call it outside the main loop, and just once (and at times when you wish to change collision mode\response, even if to turn them off).


kfprimm(Posted 2012) [#4]
I don't think collisions are functioning properly, yet. Try running the this sample. It's ported directly from the original mak sample in the Blitz3D directory.

You really ought to be using MiniB3D. My work is still far from being finished, and given that you are learning, it would be easiest for you to use a tested solution.


SystemError51(Posted 2012) [#5]
I think the MeshesIntersect command in B3D/MiniB3D may be what you're looking for.