- Home /
Raycast.normal vs collision.contacts[].normal which is better?
hello there. i am working on a endless runner game for rotating player according to slope angle i am using raycast but today i thought of another way of doing it using OnCollisionStay. i am already using this function for ground detection and slope detection. i made a vector3 variable and in OnCollisionStay set it equals to collision.contacts[].normal. it does work perfectly but in profiler showing Garbage collector about 20B. since i have heard that raycast is resource intensive and also i've noticed it. whenever raycast fires firerate drops from 60 to 59 ( i am using Finite state machine that's my raycast does not fire all the time only on few states). so my question is what is better raycast or contact.normal.
Your answer
![](https://koobas.hobune.stream/wayback/20220612221507im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Raycast do not detect when distance is closer or further than the max distance 1 Answer
How to calculate ship position and rotation in a pipeline with raycasts 0 Answers
if the fps is high the camera rotate much faster 1 Answer
Decal Rotation after instantiation 0 Answers
How to get Raycast surface normal to align particle system? 1 Answer