Jump to content

SetCallBack in Lua ?


diedir
 Share

Recommended Posts

Hi all

 

does "setcallback" working in LUA ?

 

I need to know if and when/where the bullet i throwed, touch another entity (body).

if someone could post some lines of a simple sphere touching a cube, with the callback generated, it would be great.

 

thanks everybody

have nice day

AMD Ryzen 5900HX - Nvidia RTX 3070 - 32 Go - 1To SSD - W11

Link to comment
Share on other sites

I have been asking for this for a long time. As far as I know it doesn't. Unless Josh added this in the last 3 months. Not having this functionality hurts because it makes triggers in Lua very static. ie. you can't create a body in Lua directly and get collision notification via a callback.

Link to comment
Share on other sites

ah the 'callback' issue. i don't think this will ever be resolved. This has been asked numerous times by users like rick and me but unfortunately: nothing.

Triggers could be made so easily with this enabled. Especially since you can link objects together. The only thing you can do now is either use 'Enity distance' or a static object.

http://leadwerks.com/werkspace/index.php?/topic/2069-solids-instead-of-collision-callback/page__p__18802__hl__triggers__fromsearch__1#entry18802

Link to comment
Share on other sites

It's so frustrating. With such a simple thing so much could be accomplished. So many things rely on volume triggers in games. Distance triggers have some flaws and static triggers are just hacky. Lua functions from the editor are currently being called, so it shouldn't be a big deal to get this working. Just store off a Lua function name with an entity and when that entity gets a collision call the Lua function name passing in the information.

Link to comment
Share on other sites

think of all the posibilities:

 

  • sound zones
  • trigger zones
  • death zones
  • damage zones
  • block player zones
  • gravity fields (or a force field in general)
  • special environment zone (local fog)
  • AI and path blocking zone
  • surface climbing zone (ladders, rocks, ivy roots)
  • water volume

 

When you think of it this is just a major flaw!! I mean this is practically preventing you from setting up easy gameplay mechanics. Take a look at your PI game scripts Rick. What would you be able to create with zones or volumes that can have collision callbacks?

Link to comment
Share on other sites

Yeah, pretty much everything you just posted and probably more. Like you said this is a major flaw. It's just another not finished thing. I would have had all those Thingoids out a long time ago if we had this which could have lead to a ton of gameplay videos instead of just a bunch of pretty screenshots. It makes me sick to even think about the possibilities that are missed because of this one flaw. Maybe we should really push this subject again? It can't be all that bad to get this implemented inside the editor/engine. You basically just store off a string (Lua function name) with an entity, and when the collision happens on that entity see if it has a Lua function string name and if so call it, passing the parameters.

 

The potential that this can have is huge!

Link to comment
Share on other sites

  • 2 weeks later...

What do you mean by solids? You mean like something like 3DWS? You could kind of do that right now with Thingoids, it just wouldn't be the easiest to manipulate the cubes since it would have to be done via text properties instead of dragging edges and such. Although you might be able to write a separate editor that connects to the LE Editor that shows the 2D version of the scene and allows you to construct these primitives.

Link to comment
Share on other sites

In a topic where we were also discussing triggers via Lua callback, Josh mentioned it:

http://leadwerks.com/werkspace/index.php?/topic/1485-more-thingoids/page__view__findpost__p__16270

 

Josh:

Solids are the way to handle triggers and volumes. They will be exposed soon.

 

These are better than physics-based triggers because they can be set to call an action either on a collision, or each frame, or when an entity leaves the volume.

Link to comment
Share on other sites

I don't know what he's talking about with that. You can have do the same with physics based. I'm guessing he's meaning doing bounding box checks with a solid shape like a cube. Honestly I'm pretty sure we can do that right now. I think that AABB function is available. We would have to check every entity against these cube shaped "solids" to see if they are in their bounding box. Then maintain the list so you can tell when they leave them also. Unity seems to use physics based objects to do this, but I guess you could do it with "solids" also.

 

I figured it would be easier to do it with physics because I assume the physics library handles the collisions for you, and he'd just have to store some flags per entity to tell if they are still colliding each frame and when they stop colliding.

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