Jump to content

Leadwerks 2.5 (SetEntityCallback does not work in lua? how to be?)


Alex Shiray
 Share

Recommended Posts

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

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...