Forum Discussion
Infinite
12 years agoHonored Guest
Human scans in Unity. Unity dev help needed.
Hi all, I'm trying to find the right place to ask if anyone can help me with Unity. I'm trying to publish some nude human scan assets so people can view them with Unity on the Rift. Similar to thes...
SDM
12 years agoExplorer
For flying around in Unity, I just edited the OVRPlayerController.cs script. R key is up, F key is down, pretty simple.
Not a Unity expert, nor coding expert, I'm sure others will post better code, but this works exactly as I'd like it to (lets you fly freely but also "stick" on the ground/stairs or such when you "land").
Any way, not sure if this is exactly what you are looking for, but to replicate:
Open the OVRPlayerController.cs script up in Monodevelop or such, and near the start of the actual code (line 48) you'll see:
public float GravityModifier = 0.379f;
change to:
public float GravityModifier = 0.0f;
In the // Update section, line 145, change the MoveThrottle.y line to be the same as the MoveThrottle.x and MoveThrottle.z lines. So it becomes:
MoveThrottle.y /= motorDamp;
Bit below that is the // Gravity section, change last line in that section (line 148 I think) to:
moveDirection.y += 0;
Go down to // Update Movement...//Consolidate all movement code here bit next, bit below that you'll see (line 195):
bool moveForward = false; followed by several others. Just below the existing bool entities, add two new ones:
bool moveUp = false;
bool moveDown = false;
Same format as those above the added lines.
Just a bit below that is the //WASD section. Just add these two lines after the existing WASD entries:
if (Input.GetKey(KeyCode.R)) moveUp = true;
if (Input.GetKey(KeyCode.F)) moveDown = true;
Once again formatted the same as the previous lines of code in that section. Next section is // No positional movement if we are in the air. Just add slashes before the two following code lines there so they become:
//if (!Controller.isGrounded)
// MoveScale = 0.0f;
Last bit is to go // Run! section, which is just a few more lines down, and add these lines at the bottom of that section:
if (moveUp)
MoveThrottle += DirXform.TransformDirection(Vector3.up * moveInfluence) * BackAndSideDampen;
if (moveDown)
MoveThrottle += DirXform.TransformDirection(Vector3.down * moveInfluence) * BackAndSideDampen;
Once again formatted the same as the lines of code immediately preceding.
Hope that you can follow the above, that it works as you'd like. I'd just post the script for you, but not sure if that'd be against the rules or not.
Love your work by the way, beautiful model, tastefully done.
Not a Unity expert, nor coding expert, I'm sure others will post better code, but this works exactly as I'd like it to (lets you fly freely but also "stick" on the ground/stairs or such when you "land").
Any way, not sure if this is exactly what you are looking for, but to replicate:
Open the OVRPlayerController.cs script up in Monodevelop or such, and near the start of the actual code (line 48) you'll see:
public float GravityModifier = 0.379f;
change to:
public float GravityModifier = 0.0f;
In the // Update section, line 145, change the MoveThrottle.y line to be the same as the MoveThrottle.x and MoveThrottle.z lines. So it becomes:
MoveThrottle.y /= motorDamp;
Bit below that is the // Gravity section, change last line in that section (line 148 I think) to:
moveDirection.y += 0;
Go down to // Update Movement...//Consolidate all movement code here bit next, bit below that you'll see (line 195):
bool moveForward = false; followed by several others. Just below the existing bool entities, add two new ones:
bool moveUp = false;
bool moveDown = false;
Same format as those above the added lines.
Just a bit below that is the //WASD section. Just add these two lines after the existing WASD entries:
if (Input.GetKey(KeyCode.R)) moveUp = true;
if (Input.GetKey(KeyCode.F)) moveDown = true;
Once again formatted the same as the previous lines of code in that section. Next section is // No positional movement if we are in the air. Just add slashes before the two following code lines there so they become:
//if (!Controller.isGrounded)
// MoveScale = 0.0f;
Last bit is to go // Run! section, which is just a few more lines down, and add these lines at the bottom of that section:
if (moveUp)
MoveThrottle += DirXform.TransformDirection(Vector3.up * moveInfluence) * BackAndSideDampen;
if (moveDown)
MoveThrottle += DirXform.TransformDirection(Vector3.down * moveInfluence) * BackAndSideDampen;
Once again formatted the same as the lines of code immediately preceding.
Hope that you can follow the above, that it works as you'd like. I'd just post the script for you, but not sure if that'd be against the rules or not.
Love your work by the way, beautiful model, tastefully done.
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
- 10 days ago
- 9 months ago
- 1 month ago