Alex Shiray Posted August 18, 2014 Share Posted August 18, 2014 Hi guys, I'm writing code in Lua script, help me please, how to determine the collision body and controller (body) Leadwerks 2.5 SetEntityCallback does not work in lua?(( how to be? Quote Link to comment Share on other sites More sharing options...
macklebee Posted August 18, 2014 Share Posted August 18, 2014 Hi guys, I'm writing code in Lua script, help me please, how to determine the collision body and controller (body) Leadwerks 2.5 SetEntityCallback does not work in lua?(( how to be? Look at the example scripts that come with the engine. I believe collisiontrigger.lua will show an example. Also, this page shows the inherent hooks for entity scripts: http://www.leadwerks.com/werkspace/page/documentation/_/script-reference/ edit-- wait LE2.5? How in the world did you get your hands on that? In any case, the lua collisionhook for LE2.5 could be done via an entity script: require("scripts/class") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) object.time = AppTime() function object:Collision(entity,position,normal,force,speed) if self.time < AppTime() and entity.collisiontype==COLLISION_CHARACTER then self.model:SetColor(Vec4(math.random(255)/255,math.random(255)/255,math.random(255)/255,1),1) self.time = AppTime() + 2000 end end end 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.