gamedevhqCurving the Teleport Raycast

Tyler Smallwood
2 min readNov 7, 2023

--

Objective: Turn our Raycast into a curve while trying to teleport.

Right now when we try to teleport, the raycast visual’s is just a straight line.

To get the curve we will just need to go to our right controller’s child Teleportation Interactor. Under the XR Ray Interactor, there is a section for Raycast Configuration.

The Line type has three options. Straight Line which is the default. There is Projectile Curve and Bezier Curve.

Projectile Curve will have the curve of an object the if fired. Similar to what is done in Angry Bird’s. The Velocity, acceleration, additional ground height, additional flight time and the sample Frequency.

A Bézier curve is a parametric curve used in computer graphics. We can adjust the End Point Distance, End Point Height, Control Point Distance, Control Point Height, and Sample Frequency.

I used the Bezier Curve. The Sample Frequency will make the line look smoother with higher frequency and more blocky with less. It can cause some performance if you set it high.

With that we have a curve to our raycast visuals now!

--

--

Tyler Smallwood
Tyler Smallwood

Written by Tyler Smallwood

I am passonate on learning to program and use Unity to become a skillful Unity Developer

No responses yet