Sence you are using a class we dont want to use a bool because if you make it a public member you still wont have acsess to it in the callback,or if you made it a global you would have to create a system to keep track of wich bool went to which Controller you can eather make a struct and put it in EntityUserData or use EntityKeys I will use EntityKeys
this is just off of the top of my head; not sure if will compile.
#include "engine.h"
#include "Class_Name.h"
//Collision Callback
void _stdcall Controller_Collision_Callback( TEntity entity0, TEntity entity1, byte* position, byte* normal, byte* force, flt speed){
//if our controller exists
if(EntityExists(entity0)==1){
//Set Jump to 1
SetEntityKey(entity0,"Jump","1");
}
}
//Constructor
Class_Name::Class_Name(){
//Create controller
TBody Controller = CreateBodyBox(1,2,1);
//Set Proproties
//Collision type
EntityType(Controller,3);
//Mass
EntityMass(Controller,10);
//Set Collision Callback to Controller_Collision_Callback
EntityCallback(Controller,(byte*)Controller_Collision_Callback,ENTITYCALLBACK_COLLISION);
}
//Call this function every time you want to update the controller
void Class_Name::Update(){
//Check if Controller Exists
if(EntityExists(Controller)){
//Check Jump
if(GetEntityKey(Controller,"Jump","NULL")=="1"){
//Make The Controller Jump
SetBodyForce(Controller,Vec3(0,100,0));
//Reset the Jump Key
SetEntityKey(entity0,"Jump","0");
}
}
}
Class_Name::~Class_Name(){
//Free controller
FreeEntity(Controller);
}