Arska134 Posted December 1, 2011 Share Posted December 1, 2011 I just wanna know how i can get TModel impact force when two models collides. Can't found function for this one. :/ Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
ParaToxic Posted December 1, 2011 Share Posted December 1, 2011 You can use the Collision Callback function of LE.In this function you can receive the force with which it collided. void _stdcall EntityCollisionCallback( TEntity entity0, TEntity entity1, byte* position, byte* normal, byte* force, flt speed ) Quote Link to comment Share on other sites More sharing options...
Arska134 Posted December 1, 2011 Author Share Posted December 1, 2011 "Compile Error: Identifier 'entitycollisioncallback' not found" I am using BlitzMax. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
macklebee Posted December 1, 2011 Share Posted December 1, 2011 did you set the collision call back with SetEntityCallback()? Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Arska134 Posted December 1, 2011 Author Share Posted December 1, 2011 Any little example about how to use SetEntityCallback() ? Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
macklebee Posted December 1, 2011 Share Posted December 1, 2011 sure... Framework leadwerks.engine Import "c:\program files\leadwerks engine sdk\bmx\framework\framework.bmx" RegisterAbstractPath(AppDir) GCSetMode(2) Graphics(800, 600) fw:TFramework = CreateFramework() If Not fw RuntimeError "Failed to initialize engine." PositionEntity(fw.Main.Camera, Vec3(0, 1, - 4)) light:TLight = CreateDirectionalLight() RotateEntity(light, Vec3(45, 45, 0)) drum:TModel = LoadModel("abstract::oildrum.gmf") SetBodyMass(drum, 1) EntityType(drum, 1) PositionEntity(drum, Vec3(0, 5, 0)) groundbody:TBody = CreateBodyBox(10, .1, 10) EntityType(groundbody, 1) groundmesh:TMesh = CreateCube(groundbody) ScaleEntity(groundmesh, Vec3(10, .1, 10)) EntityColor(groundmesh, Vec4(.5, 0, .5, 1)) Collisions(1, 1, 1) SetEntityCallback(drum, MyCallBack, ENTITYCALLBACK_COLLISION) Repeat If KeyHit(KEY_ESCAPE) Exit If AppTerminate() Exit If KeyHit(KEY_SPACE) PositionEntity(drum, Vec3(Rand(0, 3), Rand(1, 8), Rand(0, 3))) RotateEntity(drum, Vec3(Rand(0, 90), Rand(0, 90), Rand(0, 90))) End If fw.Update() fw.Render() Flip(1) Forever GCCollect() End Function MyCallBack(entity0:TEntity, entity1:TEntity, position:Tvec3, normal:Tvec3, force:Tvec3, speed:Float) AppLog("Position: " + position.x + ", " + position.y + ", " + position.z) AppLog("Normal: " + normal.x + ", " + normal.y + ", " + normal.z) AppLog("Force: " + force.x + ", " + force.y + ", " + force.z) AppLog("Speed: " + speed) End Function Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.