Jump to content

How to : Raycast collision filter


YouGroove
 Share

Recommended Posts

I would want mobs to have raycast only colliding with :

- player

-scene

- physic objects decoration

But have the raycast not colliding with some static barriers.

(The mobs will fire at player even when it is hidden behind some specific cover objects)

 

How to code that declaring new collisions ?

Stop toying and make games

Link to comment
Share on other sites

It's again info hidden on the forums.

 

Agree that Collision:SetResponse() needs to be added to the documentation... but you have asked and been given this answer before...wink.pnghttp://www.leadwerks.com/werkspace/topic/10362-physics-collision-overlap/page__hl__overlap

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

I have some question as this is still not clear for me :

- mobs raycast shound not detect a cover object

- player raycast should detect cover barrier

 

How does this works in Lua ?

Cover.lua

 

function Script:Start()
entity:SetCollisionType(30)
Collision:SetResponse(30, Collision.Prop, Collision.Trigger)
end

 

What must be the mob code and player code to have in one case the raycast not detect that barrier and in the other case the raycast detecting that barrier ?

 

 

Agree that Collision:SetResponse() needs to be added to the documentation... but you have asked and been given this answer before...

When i come back to LE3 i forgot many things, having some solid tutorials and docs is what really matters with 3D engines wink.png

Stop toying and make games

Link to comment
Share on other sites

You can set the collisiontype for any of the raycast commands, so you would setup a response between the player raycast's and the cover's collisiontypes. For the mob's raycast, you have to set the collisiontype to something other than 0 as this will detect everything.

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

You mean :

 

Mob.lua :

 

Start()
Collision:SetResponse(30, Collision.Prop, Collision.none)
...
end

 

player.lua

 

 

 

Start()
Collision:SetResponse(30, Collision.Prop, Collision.Trigger)
...
end 

 

coverAsset.lua

Start()
entity:SetCollisionType(30)
-- collision between cover and characters
Collision:SetResponse(30, Collision.character, Collision.Trigger)
-- collision between cover and physic moving objects
Collision:SetResponse(30, Collision.Prop, Collision.Trigger)

...
end 

Stop toying and make games

Link to comment
Share on other sites

It's probably best to set all of these in App.lua Start() so you know where they all are. It's best to write down on paper what responses you want first can it can get complicated quickly.

 

Also note these are global flags. So not sure why you would set 30 and prop to trigger in 2 different places. You only have to do it once and it'll be global response.

Link to comment
Share on other sites

I needed the asset cover to be type 30 , a particular type that is a cover.

And i need

- any physic object to collide with this asset cover

- mob raycast should not detect the cover physics

- only player raycast detect the cover as a prop asset

So what is the Lua Collision:SetResponse() for both mobs and player ?

 

The goal is to have the mobs firing at the player even if he is hidden behind the cover asset.

So the player is covered but mobs are still firing at it's position, if the player moves a little outside of the cover it will receive fire damage already.

It's some Gears Of War touch wink.png

Stop toying and make games

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