2D Collision, Physics, Rigid body dynamics

BlitzMax Forums/BlitzMax Programming/2D Collision, Physics, Rigid body dynamics

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

If you need an Arbiter Stub then use this one, i'll have it finished real soon:

Rem
* Copyright (c) 2006 Erin Catto http://www.gphysics.com"
*
* Permission To use, copy, modify, distribute And sell this software
* And its documentation For any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies.
* Erin Catto makes no representations about the suitability 
* of this software For any purpose.  
* It is provided "as is" without express Or implied warranty.
End Rem

'/**
' *
' */
Const inEdge1:Int = 0
Const inEdge2:Int = 1
Const outEdge1:Int = 2
Const outEdge2:Int = 3

'/**
' *
' */
Type TFeaturePair

	Field e:Byte Ptr
	Field key:Int

	Method New( )
		e = Byte Ptr( Varptr( key ) )
	End Method

End Type

'/**
' *
' */
Type TContact

	Field position:TVec2
	Field normal:TVec2
	Field separation:Float
	Field accumulatedNormalImpulse:Float
	Field accumulatedTangentImpulse:Float
	Field massNormal:Float, massTangent:Float
	Field bias:Float
	Field feature:TFeaturePair;

End Type

'/**
' *
' */
Function Arbiter:TArbiter( a:TBody, b:TBody )

End Function

'/**
' *
' */
Type TArbiter

	Const MAX_POINTS:Int = 2
	
	Field contacts:TContact[MAX_POINTS]
	Field numContacts:Int
	Field body1:TBody
	Field body2:TBody
	Field friction:Float
	
	Method Update( contacts:TContact[], int numContacts )
	
	End Method
	
	Method PreStep( inv_dt:Float )
		
	End Method

	Method ApplyImpulse( )
	
	End Method

End Type


Instead of TFeaturePair.e.inEdgex use TFeaturePair.e[inEdgex] ;)