- Home /
Where should I call Physics2D.Raycast ?
Hi all!
I'm developing a little game that I'm testing it.
In the game the player can move only throughs a sequence of nodes; every node have a circle collider.
When the player give the movement input, i simply check if the raycast2d collide with one of these nodes the player proceed to that node, otherwise he jump into the water (game over).
These nodes are moved by an animator.
I'm sure that I use raycast correctly, but in some rare cases it doesn' t find the node where the player should jump.
In the player controller, after the movement's input I cast the ray into the update procedure; if there is a node, the player is moved to the node position with the function movetowards in the fixed update procedure.
Should i call the raycast2d into the fixedupdate or I miss something else?
There is no problem of intersection with the player collider and I've set up the layer mask properly.
Your answer
Follow this Question
Related Questions
How to use OverlapCollider? 1 Answer
Identifier expected on equals symbol 1 Answer
Physics2D.Linecast ignoring walls 1 Answer
Can a collider be solid along one axis only? 2 Answers
Script Help -- OnCollisionEnter2D 1 Answer