Jump to content

Physics : onCollisionEnter


YouGroove
 Share

Recommended Posts

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.

  • Upvote 1

Stop toying and make games

Link to comment
Share on other sites

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.

 

post-45-0-10935000-1388102648.jpg

 

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

  • Upvote 3
Link to comment
Share on other sites

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.

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

  • 2 weeks later...

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