I'm having a little trouble with my game physics. I've defined a type object called Mass and added the mesh to be used as a field, as well as some important info about the mesh (it's current velocity, previous location, etc). What I need to do now is return the type object of the mesh when using the CollisionEntity() function (at the moment it only returns the mesh) so I can get ahold of the velocities etc. Is this possible, or do I need to rethink my strategy here?
many thanks for any help you can give
Type Mass Field name Field mass Field Msh Field x# Field y# Field z# Field xvel# Field yvel# Field zvel# Field xacc# Field yacc# Field zacc# End Type oMsh = CreateSphere() m1.mass = createmass(omsh,200,0,0,10) FreeEntity omsh EntityColor m1\msh,255,0,0 omsh = CreateSphere() m2.mass = createmass(omsh,-200,0,0,10) FreeEntity omsh EntityColor m2\msh,0,255,0 c1 = CreateCamera() PositionEntity c1,0,0,-1000 CameraRange c1,0.1,2000 l1 = CreateLight() PositionEntity l1,0,0,100 m1\xvel = -5 m1\yvel = 0 m1\zvel = 0 m2\xvel = 5 m2\yvel = 0 m2\zvel = 0 Collisions 1,1,1,1 While Not KeyDown(1) Locate 0,0 For m.Mass = Each Mass For Col = 1 To CountCollisions(m\msh) ColEnt = CollisionEntity(m\msh,1) ;need to retrieve colEnt's xvel, yvel and zvel values here Next CalculateNewtonian(m) MoveEntity m\msh,m\xvel,m\yvel,m\zvel Next UpdateWorld RenderWorld Flip Wend
many thanks for any help you can give