Jump to content

How to get TModel impact force


Arska134
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...