playMaker

Author Topic: Raycast inconsistent while flicking  (Read 559 times)

swiiiftz

  • Playmaker Newbie
  • *
  • Posts: 3
Raycast inconsistent while flicking
« on: August 28, 2021, 05:09:01 PM »
I got a Problem and cant really figure out what is causing it.
Followed the FPS tutorials on Youtube and started messing around with it to implement more than 2 colors and a "pickup beam" while holding objects.

Now when i am holding something and move the mouse slowly across the screen everything works liie intended. But as soon as I start flicking the mouse a bit faster the Raycast goes through the object even tho at least visually it should still hit it.
On this for a few hours now and cant figure out what is causing this. Any help is much appreciated.


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Raycast inconsistent while flicking
« Reply #1 on: August 28, 2021, 09:43:41 PM »
Hi.
If you turn on debug on the raycast you will see what happens on the scene view.

you might get better results with a collider instead of a raycast but i think even that has its limit.

Basically its a frame issues the raycast will cast once every frame so if you turn very fast it will cast for example 1 frame in 0 degree and the next in 45 degree.

Btw this is basically on all game engines not only unity.