tipforeveryone Posted October 27, 2016 Share Posted October 27, 2016 I can use a box with Collision Type = Trigger to detect player function Script:Collision(entity,position,normal,speed) self.playerInside = true end But I can't figure out how to execute when player NOT collides this box something likes function Script:Collision(entity,position,normal,speed) if entity == player then self.playerInside = true else self.playerInside = false --how can I do this :"D end end Quote Link to comment Share on other sites More sharing options...
Rick Posted October 27, 2016 Share Posted October 27, 2016 Generally the way ppl do this is by checking the entities "name" key. If entity:GetKeyValue("name") == "player" then else end Then in whatever script you have attached to your player you set the name key to "player". If you are using the player script that comes with le I think this is already set for you. 1 Quote Link to comment Share on other sites More sharing options...
tipforeveryone Posted October 27, 2016 Author Share Posted October 27, 2016 This does not work I try function Script:Collision(entity,position,normal,speed) if entity:GetKeyValue("name") == "PlayerControl" then System:Print("hit") else System:Print("no hit") end end Then there is no "no hit" in output when player is outside of trigger box, of course it will display "hit" when player step inside the box. I want to do something when player step out or out side triggerbox. Quote Link to comment Share on other sites More sharing options...
macklebee Posted October 28, 2016 Share Posted October 28, 2016 I think this is what you are looking for: http://www.leadwerks.com/werkspace/topic/7992-physics-oncollisionenter/#entry62987 1 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...
tipforeveryone Posted October 28, 2016 Author Share Posted October 28, 2016 Yes it is, thank you. This works perfectly 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.