Tanoda
AutopilotSystem.cs
Go to the documentation of this file.
1
/******************************************************************************
2
* Copyright (C) Ultraleap, Inc. 2011-2020. *
3
* *
4
* Use subject to the terms of the Apache License 2.0 available at *
5
* http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6
* between Ultraleap and you, your company or other organization. *
7
******************************************************************************/
8
9
using
System.Collections;
10
using
System.Collections.Generic;
11
using
UnityEngine
;
12
13
namespace
Leap.Unity.Examples
{
14
15
[AddComponentMenu(
""
)]
16
public
class
AutopilotSystem
: MonoBehaviour {
17
18
public
Spaceship
spaceship
;
19
20
private
float
_targetSpeed = 0F;
21
private
Vector3 _targetTorque = Vector3.zero;
22
23
private
float
_currentSpeed = 0F;
24
public
float
currentSpeed
{
get
{
return
_currentSpeed; } }
25
26
public
void
IncreaseSpeed
() {
27
_targetSpeed += 5F;
28
}
29
30
public
void
IncreaseTorque
() {
31
_targetTorque += 36f * Vector3.one;
32
}
33
34
public
void
Stop
() {
35
_targetSpeed = 0F;
36
_targetTorque = Vector3.zero;
37
}
38
39
void
Update() {
40
spaceship
.
velocity
= _targetSpeed * Vector3.forward;
41
spaceship
.
angularVelocity
= _targetTorque;
42
}
43
44
}
45
46
}
Leap.Unity.Examples.AutopilotSystem
Definition:
AutopilotSystem.cs:16
Leap.Unity.Examples.AutopilotSystem.IncreaseSpeed
void IncreaseSpeed()
Definition:
AutopilotSystem.cs:26
Leap.Unity.Examples.AutopilotSystem.currentSpeed
float currentSpeed
Definition:
AutopilotSystem.cs:24
Leap.Unity.Examples.AutopilotSystem.Stop
void Stop()
Definition:
AutopilotSystem.cs:34
Leap.Unity.Examples.AutopilotSystem.spaceship
Spaceship spaceship
Definition:
AutopilotSystem.cs:18
Leap.Unity.Examples.AutopilotSystem.IncreaseTorque
void IncreaseTorque()
Definition:
AutopilotSystem.cs:30
Leap.Unity.Examples.Spaceship
The spaceship in this example is a kinematic rigidbody with a force API, but having a rigidbody on yo...
Definition:
Spaceship.cs:33
Leap.Unity.Examples.Spaceship.velocity
Vector3 velocity
Definition:
Spaceship.cs:52
Leap.Unity.Examples.Spaceship.angularVelocity
Vector3 angularVelocity
Definition:
Spaceship.cs:62
Leap.Unity.Examples
Definition:
InertiaPostProcessProvider.cs:12
UnityEngine
Definition:
HSVPicker/UtilityScripts/BoxSlider.cs:7
Source
Assets
Plugins
LeapMotion
Modules
InteractionEngine
Examples
7. Moving Reference Frames
Scripts
AutopilotSystem.cs
Generated by
1.9.3