Playmaker Forum

Playmaker Help & Tips => Playmaker Help => Topic started by: miguelfanclub on August 20, 2018, 12:03:13 PM

Title: Raycast giving DID HIT when the object that was hitted has no longer collision
Post by: miguelfanclub on August 20, 2018, 12:03:13 PM
1. I do raycast over a layer
2. Object that has been hitted get triggered
    2a. I stop raycasting
    2b. I disable the collision of the object that has been hitted (Enable collider action). I have veryfied the collision is no longer active
3. I display some text
4. Do raycast again (ray is exactly in the same position, just hitting same object) giving positive Did hit

Should this be happening?

I can fix it if i set a different layer so raycast is no longer afecting in point 2b
Title: Re: Raycast giving DID HIT when the object that was hitted has no longer collision
Post by: miguelfanclub on August 24, 2018, 04:10:02 PM
????
Title: Re: Raycast giving DID HIT when the object that was hitted has no longer collision
Post by: djaydino on August 24, 2018, 09:17:46 PM
hi.
Try putting a next frame event in between (after disabling the collider)
The real disabling might happen slower that the next raycast (within the same frame)

This is a unity thing btw, you would have the same result if you would code in C#

it has to do with the update types
Title: Re: Raycast giving DID HIT when the object that was hitted has no longer collision
Post by: miguelfanclub on August 25, 2018, 07:32:23 AM
Thanks, but is another issue as the weird thing is that while i display the text after the first hit, i need to press space to continue and then the raycast come up again hitting on the object that has no collision and giving a positive hit (while the text is displayed I can see the object has no collision in the inspector)



Title: Re: Raycast giving DID HIT when the object that was hitted has no longer collision
Post by: djaydino on August 25, 2018, 09:46:56 AM
Hi.
That is strange indeed.

Is it the standard "Raycast" action that you are using?
Title: Re: Raycast giving DID HIT when the object that was hitted has no longer collision
Post by: miguelfanclub on August 25, 2018, 10:42:42 AM
Im using raycast 2
Title: Re: Raycast giving DID HIT when the object that was hitted has no longer collision
Post by: djaydino on August 25, 2018, 10:57:36 AM
Hi.
I cant really test now..

For testing :

Can you try to do the 2nd raycast from a different state (the same way as the 1st one)
So after disable do raycast again but from a different state.

Reason : maybe the raycast2 data did not reset when going back to the state/action

does it work with the standard raycast? (you probably need to no hit event, but just for testing when hitting :) )

I will test myself when i get home tomorrow or monday