# Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

### Newcomers AppGameKit Corner / AppGameKit VR - teleportation arc raycast ?

Message
Posted: 17th May 2023 07:01
Hello!
I am very new to AppGameKit (and all the VR stuff).
Can anyone point me into the right direction?

I want to teleport my player in a 3D world to different destinations by using the thumb stick of my controller.
I would like to see a nice arc from controller to the destination point.
How can I do that?
Maybe you got a code snippet (Tier 1 or Tier 2) you would like to share?

How do I calculate the arc from controller to destination?
How can I make the arc visible (particles or what?)?
How can I calculate the destination coords?

Posted: 25th May 2023 20:18
There's a lot of questions there.
First, the co-ords of the controller would be available from the VR API command set.
Next, the destination would be where you select - I mean, you are going to move the thumb stick around to position the target position, so you'll know where it is when you move the target around. Use a box or something temporarily.
Assume now then, that you have 2 XYZ co-ordinates. You need to make a curve effect to the destination (much like I think in Robo Recall?)
For the arc visual part, you could make a segmented poly object using quad polys, (or a pipe) where you could mathematically alter the vertex data based on a spline or bezier.
If you use 3D physics, I seem to remember some functions there which could allow for simulating rope/chain which you may be able to use.
Posted: 17th Aug 2023 18:45
Raycast from the Controller in the direction it's pointing... when it hits you use that as the "End Point"
The "Start Point" is a position between the Ground and Head Height

Then you simply determine a Maximum Distance you want to allow Teleportation.
Once you've got that, you can use that Distance as a Percentage to determine the Height of the Triangle (between the Start and End Point)

With that Triangle you can use a Quadratic Beizer Curve and a pre-determined number of iterations to then calculate the Curvature over said Distance to then provide you with each of the Start and End Points of the Planes.

This will provide you with an Arcing Series of Planes from the "Player" to the Targeted Destination that will Arc based upon Distance; with the Maximum Distance being a very light / linear curve.

Then it's just a case of added a texture to provide visual appearance...
As I do with many people., I'd recommend going to Wolfram Maths as it's an absolute treasure trove of Mathematical Equations and Concepts that you'll used REGULARLY in Programming.