Collision Problem!

Blitz3D Forums/Blitz3D Programming/Collision Problem!

Defoc8(Posted 2004) [#1]
Righty then...

- What im doing is pretty simple..
- i have a mesh used as the visible game object
- another much simpler mesh used in collisions
- and a pivot used in collisions...

The first collision test involves assigning a radius
to the pivots - if two pivots collide - i know that a
sphere to sphere collision has occurred + can now test
whether or not the relevant meshes intersect...

So what i need to do is find out which actor instances these
pivots belong to + use the collision meshes for those actors
in the meshintersect test...

Given that most collisions will be quads to collision
meshes..and the meshes are very low poly..the test doesnt
really cause much slowdown...

anyway...the point is...
- is there a fast way of determining which actor instance
- the pivot belongs to? [actors are new type instances]
- i dont want to scan the list every time..hmmm

I could create an array indexed by pivot handle - but this
is wasteful..is there an alternative???

I hope someone understands what im trying to say here :/

matt/defoc8


Drago(Posted 2004) [#2]
you could set the pivots name to have something to do with the object it represents, for example from what I can tell you are using types for somrthing to do with the object, so if you name the pivot the Handle value of the type that correspondes to the entity that the afore mentioned pivot belongs.

for example
type ship
   field X#,Y,Z#
   field Someotherstuff....
   field Entity
end type

....
player.ship=new ship
shiphandle = handle(player)
pivot=createpivot()
entityname pivot,shiphandle

; then when that pivot may have collided, you can do this.
s.ship=object.ship(entityname(pivot)



now you have the type associated with the pivot, and its ship or whatever.

If I have completely missed the plot let me know :)


Defoc8(Posted 2004) [#3]
Cheers Drago :)))
- yup that helps ;)