YouGroove Posted December 26, 2013 Share Posted December 26, 2013 A simple physic function available on other 3D engines, and super usefull very missing in Leadwerks 3. Actually in LE3 you make some fake collision detection using distance, can be good for some situations and game styles, but for lot of stuff real trigger when entering collision and having the name of object colliding (or list), would bring LE3 to a new level in terms of gameplay programming. Suggestion for future 3.1 perhaps. 1 Quote Stop toying and make games Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 26, 2013 Share Posted December 26, 2013 The tutorials have this script but it is not part of the api. You have access to OnCollide and OnExit Quote Link to comment Share on other sites More sharing options...
Rick Posted December 26, 2013 Share Posted December 26, 2013 Where is the OnExit function script? I'll have to start looking at how to do this globally. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 26, 2013 Share Posted December 26, 2013 My bad, I meant the tutorials for 3.1. I will have to ask if I can share it though. Quote Link to comment Share on other sites More sharing options...
Rick Posted December 26, 2013 Share Posted December 26, 2013 OK cool. Yeah, OnExit is really the biggest thing since we can just use a bool in our script inside OnCollide for an OnEnter. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted December 27, 2013 Share Posted December 27, 2013 Here you go! It is designed for usage with the flowgraph editor, but it can be easily adjusted ofcourse, Thanks you to Josh for pre-sharing. CollisionTrigger.zip Script.entered = false Script.exited = false Script.hasCollision = false; function Script:UpdatePhysics() if self.entered then if self.hadCollision == false then if self.exited == false then self.exited = true self.component:CallOutputs("TriggerExit") self.entered = false end end end self.hadCollision = false end function Script:Collision(entity, position, normal, speed) self.hadCollision = true if self.entered == false then self.component:CallOutputs("TriggerEnter") self.entered = true self.exited = false end end 3 Quote Link to comment Share on other sites More sharing options...
Rick Posted December 27, 2013 Share Posted December 27, 2013 That works. I wish it was done automatically behind the LE scene for us (as it would be a little cleaner for us) but this works too. Thanks. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted December 27, 2013 Author Share Posted December 27, 2013 Does it works with real physic shape collision of the model or some approximative box model collsion ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Josh Posted December 28, 2013 Share Posted December 28, 2013 FYI, if you use the "trigger" collision mode, collisions will continually be sent even if the object is completely inside the other (and no surfaces are intersecting). This does not occur with normal collision. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rick Posted January 7, 2014 Share Posted January 7, 2014 Putting this code on the wiki, because it's gold really 2 Quote 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.