Skip to content

Commit

Permalink
feat(BodyPhysics): add body physics script
Browse files Browse the repository at this point in the history
  > ** Breaking Changes **

The Body Physics script is a replacement for the Player Presence script
and also handles snapping to nearest floor which has now also been
removed from the Height Adjust Teleporter script.

The Height Adjust Teleport script now purely deals with changing the
position of the play area based on the destination marker and does not
attempt to snap to the nearest floor.

The Body Physics script handles creating a rigidbody and collider for
to represent the user and this prevents a user from walking through
items when the play area is being moved around. It also allows for
gravity to make the user fall off objects.

If the user physically walks in the play area then the movement is
detected and the user rigidbody is set to kinematic to allow walking
into objects and prevent the sickly pushing the world away issue.

Also, leaning over objects is allowed by checking to see if the user
is leaning over a valid object and setting the rigidbody to kinematic
so the rigidbody doesn't push the user away.

Snapping to the nearest floor is also handled by the new Body Physics
script and it determines whether to use gravity or to use the
attached teleporter to teleport the user to the new floor.

The fall restrictions based on the controller position is also in the
Body Physics script, so a controller held over the existing floor will
prevent falling to allow peering over ledges.

The relevant example scenes have been updated to include the new
Body Physics script and all other example scenes have been tidied up
a bit so the script order is a bit more uniform.
  • Loading branch information
thestonefox committed Nov 25, 2016
1 parent fdd760c commit 68d6e50
Show file tree
Hide file tree
Showing 56 changed files with 30,012 additions and 12,407 deletions.
750 changes: 584 additions & 166 deletions Assets/VRTK/Examples/002_Controller_Events.unity

Large diffs are not rendered by default.

982 changes: 701 additions & 281 deletions Assets/VRTK/Examples/003_Controller_SimplePointer.unity

Large diffs are not rendered by default.

980 changes: 714 additions & 266 deletions Assets/VRTK/Examples/004_CameraRig_BasicTeleport.unity

Large diffs are not rendered by default.

984 changes: 703 additions & 281 deletions Assets/VRTK/Examples/005_Controller_BasicObjectGrabbing.unity

Large diffs are not rendered by default.

990 changes: 707 additions & 283 deletions Assets/VRTK/Examples/006_Controller_UsingADoor.unity

Large diffs are not rendered by default.

1,012 changes: 725 additions & 287 deletions Assets/VRTK/Examples/007_CameraRig_HeightAdjustTeleport.unity

Large diffs are not rendered by default.

1,246 changes: 835 additions & 411 deletions Assets/VRTK/Examples/008_Controller_UsingAGrabbedObject.unity

Large diffs are not rendered by default.

979 changes: 722 additions & 257 deletions Assets/VRTK/Examples/009_Controller_BezierPointer.unity

Large diffs are not rendered by default.

1,216 changes: 920 additions & 296 deletions Assets/VRTK/Examples/010_CameraRig_TerrainTeleporting.unity

Large diffs are not rendered by default.

904 changes: 648 additions & 256 deletions Assets/VRTK/Examples/011_Camera_HeadSetCollisionFading.unity

Large diffs are not rendered by default.

1,085 changes: 754 additions & 331 deletions Assets/VRTK/Examples/012_Controller_PointerWithAreaCollision.unity

Large diffs are not rendered by default.

1,058 changes: 741 additions & 317 deletions Assets/VRTK/Examples/013_Controller_UsingAndGrabbingMultipleObjects.unity

Large diffs are not rendered by default.

1,062 changes: 743 additions & 319 deletions Assets/VRTK/Examples/014_Controller_SnappingObjectsOnGrab.unity

Large diffs are not rendered by default.

943 changes: 697 additions & 246 deletions Assets/VRTK/Examples/015_Controller_TouchpadAxisControl.unity

Large diffs are not rendered by default.

1,144 changes: 784 additions & 360 deletions Assets/VRTK/Examples/016_Controller_HapticRumble.unity

Large diffs are not rendered by default.

1,039 changes: 733 additions & 306 deletions Assets/VRTK/Examples/017_CameraRig_TouchpadWalking.unity

Large diffs are not rendered by default.

704 changes: 575 additions & 129 deletions Assets/VRTK/Examples/018_CameraRig_FramesPerSecondCounter.unity

Large diffs are not rendered by default.

956 changes: 706 additions & 250 deletions Assets/VRTK/Examples/019_Controller_InteractingWithPointer.unity

Large diffs are not rendered by default.

901 changes: 683 additions & 218 deletions Assets/VRTK/Examples/020_CameraRig_MeshTeleporting.unity

Large diffs are not rendered by default.

1,020 changes: 722 additions & 298 deletions Assets/VRTK/Examples/021_Controller_GrabbingObjectsWithJoints.unity

Large diffs are not rendered by default.

983 changes: 724 additions & 259 deletions Assets/VRTK/Examples/022_Controller_CustomBezierPointer.unity

Large diffs are not rendered by default.

991 changes: 706 additions & 285 deletions Assets/VRTK/Examples/023_Controller_ChildOfControllerOnGrab.unity

Large diffs are not rendered by default.

1,011 changes: 738 additions & 273 deletions Assets/VRTK/Examples/024_CameraRig_ExcludeTeleportLocations.unity

Large diffs are not rendered by default.

1,068 changes: 760 additions & 308 deletions Assets/VRTK/Examples/025_Controls_Overview.unity

Large diffs are not rendered by default.

998 changes: 712 additions & 286 deletions Assets/VRTK/Examples/026_Controller_ForceHoldObject.unity

Large diffs are not rendered by default.

994 changes: 701 additions & 293 deletions Assets/VRTK/Examples/027_CameraRig_TeleportByModelVillage.unity

Large diffs are not rendered by default.

1,003 changes: 710 additions & 293 deletions Assets/VRTK/Examples/028_CameraRig_RoomExtender.unity

Large diffs are not rendered by default.

739 changes: 580 additions & 159 deletions Assets/VRTK/Examples/029_Controller_Tooltips.unity

Large diffs are not rendered by default.

921 changes: 694 additions & 227 deletions Assets/VRTK/Examples/030_Controls_RadialTouchpadMenu.unity

Large diffs are not rendered by default.

1,022 changes: 686 additions & 336 deletions Assets/VRTK/Examples/031_CameraRig_HeadsetGazePointer.unity

Large diffs are not rendered by default.

1,076 changes: 743 additions & 333 deletions Assets/VRTK/Examples/032_Controller_CustomControllerModel.unity

Large diffs are not rendered by default.

733 changes: 599 additions & 134 deletions Assets/VRTK/Examples/033_CameraRig_TeleportingInNavMesh.unity

Large diffs are not rendered by default.

1,004 changes: 671 additions & 333 deletions Assets/VRTK/Examples/034_Controls_InteractingWithUnityUI.unity

Large diffs are not rendered by default.

741 changes: 583 additions & 158 deletions Assets/VRTK/Examples/035_Controller_OpacityAndHighlighting.unity

Large diffs are not rendered by default.

397 changes: 189 additions & 208 deletions Assets/VRTK/Examples/036_Controller_CustomCompoundPointer.unity

Large diffs are not rendered by default.

1,166 changes: 836 additions & 330 deletions Assets/VRTK/Examples/037_CameraRig_ClimbingFalling.unity

Large diffs are not rendered by default.

1,010 changes: 724 additions & 286 deletions Assets/VRTK/Examples/038_CameraRig_DashTeleport.unity

Large diffs are not rendered by default.

264 changes: 132 additions & 132 deletions Assets/VRTK/Examples/039_CameraRig_AdaptiveQuality.unity
Original file line number Diff line number Diff line change
Expand Up @@ -749,134 +749,6 @@ Camera:
m_StereoConvergence: 10
m_StereoSeparation: 0.022
m_StereoMirrorMode: 0
--- !u!43 &864762688
Mesh:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
serializedVersion: 8
m_SubMeshes:
- serializedVersion: 2
firstByte: 0
indexCount: 24
topology: 0
firstVertex: 0
vertexCount: 8
localAABB:
m_Center: {x: 0, y: 0.01, z: 0}
m_Extent: {x: 1.5000001, y: 0, z: 1.25}
m_Shapes:
vertices: []
shapes: []
channels: []
fullWeights: []
m_BindPose: []
m_BoneNameHashes:
m_RootBoneNameHash: 0
m_MeshCompression: 0
m_IsReadable: 1
m_KeepVertices: 1
m_KeepIndices: 1
m_IndexBuffer: 000004000100010004000500010005000200020005000600020006000300030006000700030007000000000007000400
m_Skin: []
m_VertexData:
m_CurrentChannels: 13
m_VertexCount: 8
m_Channels:
- stream: 0
offset: 0
format: 0
dimension: 3
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 12
format: 0
dimension: 4
- stream: 0
offset: 28
format: 0
dimension: 2
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 0
format: 0
dimension: 0
m_DataSize: 288
_typelessdata: ceccac3f0ad7233ccdcc8cbf000000000000803f0000803f0000803f0000000000000000ceccacbf0ad7233ccdcc8cbf000000000000803f0000803f0000803f0000803f00000000ceccacbf0ad7233ccdcc8c3f000000000000803f0000803f0000803f0000000000000000ceccac3f0ad7233ccdcc8c3f000000000000803f0000803f0000803f0000803f000000000100c03f0ad7233c0000a0bf000000000000803f0000803f00000000000000000000803f0100c0bf0ad7233c0000a0bf000000000000803f0000803f000000000000803f0000803f0100c0bf0ad7233c0000a03f000000000000803f0000803f00000000000000000000803f0100c03f0ad7233c0000a03f000000000000803f0000803f000000000000803f0000803f
m_CompressedMesh:
m_Vertices:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_UV:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_Normals:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_Tangents:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_Weights:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_NormalSigns:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_TangentSigns:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_FloatColors:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_BoneIndices:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_Triangles:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_UVInfo: 0
m_LocalAABB:
m_Center: {x: 0, y: 0.01, z: 0}
m_Extent: {x: 1.5000001, y: 0, z: 1.25}
m_MeshUsageFlags: 0
m_BakedConvexCollisionMesh:
m_BakedTriangleCollisionMesh:
m_MeshOptimized: 0
--- !u!1 &949046215
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1020,6 +892,134 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
--- !u!43 &1045492063
Mesh:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
serializedVersion: 8
m_SubMeshes:
- serializedVersion: 2
firstByte: 0
indexCount: 24
topology: 0
firstVertex: 0
vertexCount: 8
localAABB:
m_Center: {x: 0, y: 0.01, z: 0}
m_Extent: {x: 1.2, y: 0, z: 1.0500002}
m_Shapes:
vertices: []
shapes: []
channels: []
fullWeights: []
m_BindPose: []
m_BoneNameHashes:
m_RootBoneNameHash: 0
m_MeshCompression: 0
m_IsReadable: 1
m_KeepVertices: 1
m_KeepIndices: 1
m_IndexBuffer: 000004000100010004000500010005000200020005000600020006000300030006000700030007000000000007000400
m_Skin: []
m_VertexData:
m_CurrentChannels: 13
m_VertexCount: 8
m_Channels:
- stream: 0
offset: 0
format: 0
dimension: 3
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 12
format: 0
dimension: 4
- stream: 0
offset: 28
format: 0
dimension: 2
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 0
format: 0
dimension: 0
m_DataSize: 288
_typelessdata: 6766863f0ad7233c696666bf000000000000803f0000803f0000803f0000000000000000676686bf0ad7233c696666bf000000000000803f0000803f0000803f0000803f00000000676686bf0ad7233c6966663f000000000000803f0000803f0000803f00000000000000006766863f0ad7233c6966663f000000000000803f0000803f0000803f0000803f000000009a99993f0ad7233c686686bf000000000000803f0000803f00000000000000000000803f9a9999bf0ad7233c686686bf000000000000803f0000803f000000000000803f0000803f9a9999bf0ad7233c6866863f000000000000803f0000803f00000000000000000000803f9a99993f0ad7233c6866863f000000000000803f0000803f000000000000803f0000803f
m_CompressedMesh:
m_Vertices:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_UV:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_Normals:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_Tangents:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_Weights:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_NormalSigns:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_TangentSigns:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_FloatColors:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_BoneIndices:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_Triangles:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_UVInfo: 0
m_LocalAABB:
m_Center: {x: 0, y: 0.01, z: 0}
m_Extent: {x: 1.2, y: 0, z: 1.0500002}
m_MeshUsageFlags: 0
m_BakedConvexCollisionMesh:
m_BakedTriangleCollisionMesh:
m_MeshOptimized: 0
--- !u!1 &1135670851
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1099,7 +1099,7 @@ Transform:
m_Children: []
m_Father: {fileID: 506744366}
m_RootOrder: 0
--- !u!21 &1475527077
--- !u!21 &1418206982
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1344,8 +1344,8 @@ GameObject:
- 114: {fileID: 1730361485}
- 23: {fileID: 1730361484}
- 33: {fileID: 1730361483}
- 114: {fileID: 1730361481}
- 114: {fileID: 1730361482}
- 114: {fileID: 1730361481}
- 114: {fileID: 1730361480}
m_Layer: 0
m_Name: '[CameraRig]'
Expand Down Expand Up @@ -1433,7 +1433,7 @@ MeshFilter:
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1730361479}
m_Mesh: {fileID: 864762688}
m_Mesh: {fileID: 1045492063}
--- !u!23 &1730361484
MeshRenderer:
m_ObjectHideFlags: 0
Expand All @@ -1448,7 +1448,7 @@ MeshRenderer:
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_Materials:
- {fileID: 1475527077}
- {fileID: 1418206982}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
Expand Down
Loading

0 comments on commit 68d6e50

Please sign in to comment.