Jump to content

Recommended Posts

Posted

I just wanna know how i can get TModel impact force when two models collides. Can't found function for this one. :/

Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax

Posted

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 )

Posted

"Compile Error: Identifier 'entitycollisioncallback' not found"

 

I am using BlitzMax.

Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax

Posted

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

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...