Jump to content
YouGroove

Physics collision "overlap"

Recommended Posts

Would it be possible to have in LE3 collision detected only against some collision shape without having physic objects collisions interaction ?

Share this post


Link to post

If I can understand what you are describing, thats what a trigger collision response does. You would probably have to setup your own custom collision type(s) then set the response for your collision types.

 

entity1:SetCollisionType(10)

entity2:SetCollisionType(11)

Collision:SetResponse(10, 11, 2)

--where SetResponse() has three options for the 3rd parameter:

0: no response

1: collide

2: trigger

4: trigger <<--- edited: LE3 changed it to this

Share this post


Link to post

Actually in LE3 Trigger collision is super limited as it can only collide with characters

http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/collision-r778

 

 

Collision:SetResponse(10, 11, 2)

 

It seems it's C++ only method ? I don't find it for Lua or am i wrong ?

 

With Lua we would need to be able to define trigger volumes , it is usefull in gameplay in many ways could it be danger zone/spells to only specific characters, trigger event areas etc ...

Actually this is not possible.

Share this post


Link to post

Actually in LE3 Trigger collision is super limited as it can only collide with characters

Which is why I suggested above for you to create your own custom types and set the responses as needed.

 

There is a difference between a trigger collision TYPE and and a trigger collision RESPONSE. That table is showing the default (inherent) types and their responses built-into the engine. The collision names shown on the top row and left column are the built-in collision TYPES. The cells that use the red/green/yellow text are denoting what RESPONSE happens when the two types come into contact.

 

So like I posted above, the engine only has three available responses for when any two physics objects come into contact:

0: no response

1: collide

2: trigger <--actually appears to be 4

 

Actually since LE3, it appears that the value for the trigger response is set to 4 since Josh used the same variable name for trigger type and trigger response instead of numbers. So probably the safest way to setup the response is to use the Collison.* variable names so there is no confusion on what to set the values.

 

So if the built-in collision types and their responses do not fit your needs, then you can create your own custom collision types and set the responses you need (or add new responses to existing types).

for example:

entity1:SetCollisionType(10) --Custom TYPE

entity2:SetCollisionType(11) --Custom TYPE

Collision:SetResponse(10, 11, 2)

Collision:SetResponse(10, 11, Collision.Trigger)

 

List of inherent types:

Collision.Prop = 1

Collision.Scene = 2

Collision.Character = 3

Collision.Trigger = 4

Collision.Debris = 5

Collision.Projectile = 6

Collision.LineOfSight = 7

 

List of possible responses:

Collision.None = 0

Collision.Collide = 1

Collision.Trigger = 4

 

It seems it's C++ only method ? I don't find it for Lua or am i wrong ?

Its been available in lua for a couple of weeks now.

Share this post


Link to post

You really should stick to using the named constants. Technically, the values of these are allowed to change at any time, without breaking the spec.

Share this post


Link to post

The main issue is in Lua you don't have the function : Collision:SetResponse(a, b, type)

yes you do. maybe you need to update your project.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...