Jump to content

Trigger collision response for scene and props


Genebris
 Share

Recommended Posts

I'm trying to make a trigger that will detect collisions with characters, scene and props, but it seems like trigger response type works only for characters.

Collision:SetResponse(10, Collision.Scene, 2)
Collision:SetResponse(10, Collision.Prop, 2)
Collision:SetResponse(10, Collision.Character, 2)
self.entity:SetCollisionType(10)

This makes my entity work as trigger for characters, but it collides with props and scene. Using 1 as a third parameter makes it collide with everything, using 0 makes it collide with nothing.

Is it a bug or intended? Or am I doing something wrong?

Link to comment
Share on other sites

I'm trying to make a trigger that will detect collisions with characters, scene and props, but it seems like trigger response type works only for characters.

Collision:SetResponse(10, Collision.Scene, 2)
Collision:SetResponse(10, Collision.Prop, 2)
Collision:SetResponse(10, Collision.Character, 2)
self.entity:SetCollisionType(10)

This makes my entity work as trigger for characters, but it collides with props and scene. Using 1 as a third parameter makes it collide with everything, using 0 makes it collide with nothing.

Is it a bug or intended? Or am I doing something wrong?

 

The way the collision types and responses were set up a couple of months ago when I last checked:

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

 

With the following warning from Josh concerning using the constants and not the numerical values: "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."

 

So in your case, try:

Collision:SetResponse(10, Collision.Scene, Collision.Trigger)
Collision:SetResponse(10, Collision.Prop, Collision.Trigger)
Collision:SetResponse(10, Collision.Character, Collision.Trigger)
self.entity:SetCollisionType(10)
  • Upvote 1

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

This works, thank you. But I have a different problem now: my trigger now detects collision only with models, not with brushes. I have a default shelf model and a brush primitive. They both have collision type scene and GetCollisionType() returns 2 for both of them, but my trigger detects collision with brush only if it has mass or script attached. Can I do anything about it?

Link to comment
Share on other sites

but my trigger detects collision with brush only if it has mass or script attached. Can I do anything about it?

Hmmm... that's a little unexpected. But the engine does "collapse/optimize" all brushes that have no mass or a script so maybe it is intended? Sounds like you can just add an empty script to the brushes as a workaround for the time being until maybe Josh can chime in with a response.

  • Upvote 1

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

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