Forum Discussion
RaveTZ
12 years agoProtege
Dissecting Proton Pulse - Move the Paddle
I've been getting quite a few questions in regards to how things work in Proton Pulse Rift. I thought I would give brief examples on how I put things together in these threads to share the knowledge.
There is no guarantee that the knowledge given here is worth anything. Use at your own discretion. :lol:
Moving the Paddle with Head Tracking
The paddle follows your head movements on the X and Y axis, but remained Z locked.
This is quite easy actually. First, you need to create a child object in the "CameraLeft" in the OVRCameraController prefab provided by the Oculus VR Unity Integration. We will call this the "Follower Object". Place the Follower Object in front of the camera as far out as you need to give the object following it the full range it needs.
Now place the object you want to follow your movements into the scene (EX: a Paddle).
Apply the following script in C# to the Paddle object:
With the Paddle Object selected, click / drag the Follower Object into the "Follow Object" slot in the inspector. Now check "X" and "Y" but leave "Z" unchecked. Ta-da, this is how I did the paddle.
Here is a link to a unity package with an example.
https://dl.dropboxusercontent.com/u/6767980/PPRift/Example/Paddle_Follow.unitypackage
There is no guarantee that the knowledge given here is worth anything. Use at your own discretion. :lol:
Moving the Paddle with Head Tracking
The paddle follows your head movements on the X and Y axis, but remained Z locked.
This is quite easy actually. First, you need to create a child object in the "CameraLeft" in the OVRCameraController prefab provided by the Oculus VR Unity Integration. We will call this the "Follower Object". Place the Follower Object in front of the camera as far out as you need to give the object following it the full range it needs.
Now place the object you want to follow your movements into the scene (EX: a Paddle).
Apply the following script in C# to the Paddle object:
using UnityEngine;
using System.Collections;
public class FollowPosition : MonoBehaviour
{
public Transform followObject; //follow this object
public bool x; //enable or disable X axis
public bool y; //enable or disable Y axis
public bool z; //enable or disable Z axis
// Update is called once per frame
void Update ()
{
//Tells this object to follow the assigned game object
Vector3 newPosition;
newPosition.x = x ? followObject.position.x : transform.position.x;
newPosition.y = y ? followObject.position.y : transform.position.y;
newPosition.z = z ? followObject.position.z : transform.position.z;
transform.position = newPosition;
}
}
With the Paddle Object selected, click / drag the Follower Object into the "Follow Object" slot in the inspector. Now check "X" and "Y" but leave "Z" unchecked. Ta-da, this is how I did the paddle.
Here is a link to a unity package with an example.
https://dl.dropboxusercontent.com/u/6767980/PPRift/Example/Paddle_Follow.unitypackage
5 Replies
- AnonymousWho were the ad wizards who thought up this one?
- moltonExplorer
"jmsutter" wrote:
surely the finest ad wizards avaialable
Who were the ad wizards who thought up this one?
I got caught up in the old SNL reference, not trying to be a dick, thanks for sharing - budwheizzahExplorerRave, I must honorably bow to your efforts, and the Awesome that is contained within Proton Pulse.
First off my 6yr old nephew loves the game as much as I (34yrs old) do. Slap it on and you'll probably stop when you hit game over... a few times :-)
That being said I have to praise you double here since the paddle movement (and the fact that the paddle had laser guns a few times in the game) was the direct inspiration for my own demo, a 3rd person view "space" shooter in the likes of Nano Assault or Starfox 64.
I have almost the same code to move my ship as you do for your paddle, just mine has a multiplier for the range to go further and has response on the WASD keys to some degree.
Hope you can try it out... main thread is here: viewtopic.php?f=29&t=5700 - FuturescoGamesHonored GuestGreat solution, thank you very much.
And something more, proton pulse is awesome! ;) - pittsburghjoeProtegeHas anyone here ever gotten the Proton Pulse demo to run without judder on DK2?
I suspect it is due to the demo being 32bit and an aging version of the Oculus SDK
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 12 years ago
- 1 month ago
- 3 years ago