Jump to content

Collision with map


drarem
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

  • 1 month later...

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.

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