drarem Posted June 27, 2015 Share Posted June 27, 2015 The map is composed mostly of multiple Scene objects, with mass of 0. How can i tell when an object collides with the map, like a wall, building or part of terrain. Is there some key value I can access? if (entity:GetKeyValue("type") == "map") then ... end Thanks. Quote Link to comment Share on other sites More sharing options...
Thirsty Panther Posted June 27, 2015 Share Posted June 27, 2015 This will be hard to do as your character will not necessarily collide with your map. They will sit on the broader of the object. Think ground, you don't collide with the ground but rest on it. So the collision trigger will be glitchy. Are you trying to set an event when the player reaches a particular point in the map? If this is the case then create a box, set its type to trigger, set its material to invisible (materials- developer - invisible). Attach your collision script ( I use "on enter on exit" from leadwerks wiki) then use the code you have in your post to check if it's name type is the player and launch your event. The beauty of the on enter on exit script is you can use it with the flowgraph editor to trigger an event when the player first enters your box and another when they leave. Like a player first enters a hallway a monster is spawned ahead of them. When they they leave the hallway you can then spawn a monster behind them Hope this helps. Quote Link to comment Share on other sites More sharing options...
drarem Posted June 28, 2015 Author Share Posted June 28, 2015 It's more like if a monster or something it throws at you hits an obstacle it should not go through it i think. Quote Link to comment Share on other sites More sharing options...
Thirsty Panther Posted June 28, 2015 Share Posted June 28, 2015 Maybe it should be if the monster sees you he throws something at you. So that means there is nothing ( walls etc) between the monster and the player. I'm not that good at line of sight code but here is some threads that discuss it. http://www.leadwerks.com/werkspace/topic/9138-adding-line-of-sight-to-computer-enemieslua/ http://www.leadwerks.com/werkspace/topic/11975-pick-how-to-use-it/ Hope this helps. Quote Link to comment Share on other sites More sharing options...
drarem Posted June 28, 2015 Author Share Posted June 28, 2015 if you move out of the way quick enough, the object travels through walls and barricades or obstacles. Quote Link to comment Share on other sites More sharing options...
drarem Posted August 19, 2015 Author Share Posted August 19, 2015 Necro'ing this thread, if someone throws something like a ball but want it a straight trajectory. Applying a thrust makes it too unpredictable, I want it to go slower but straighter, so I set the gravity to 0 and do a move from source to destination. What could I check if this ball hits part of the scene, another prop or character instead of the player? Thanks. Quote Link to comment Share on other sites More sharing options...
Josh Posted August 19, 2015 Share Posted August 19, 2015 Use World::Pick: http://www.leadwerks.com/werkspace/page/api-reference/_/world/worldpick-r502 That's exactly how I do bullets in the weapon script. 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...
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.