-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2543 from ousttrue/fix/add_cloth_sample
[sample] package.json, URP など
- Loading branch information
Showing
8 changed files
with
118 additions
and
796 deletions.
There are no files selected for viewing
392 changes: 7 additions & 385 deletions
392
Assets/VRM10/Samples~/ClothSample/ClothViewer/ClothViewer.unity
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
Assets/VRM10/Samples~/ClothSample/ClothViewer/ClothVisualPrimitive.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using UnityEngine; | ||
|
||
namespace UniVRM10.Cloth.Viewer | ||
{ | ||
/// <summary> | ||
/// Built-in RP と URP の差異を楽に吸収してプリミティブを表示するためのクラス | ||
/// </summary> | ||
public class ClothVisualPrimitive : MonoBehaviour | ||
{ | ||
[SerializeField] private PrimitiveType _primitiveType; | ||
|
||
public PrimitiveType PrimitiveType | ||
{ | ||
get => _primitiveType; | ||
set => _primitiveType = value; | ||
} | ||
|
||
private void Start() | ||
{ | ||
var visual = GameObject.CreatePrimitive(_primitiveType); | ||
visual.transform.SetParent(transform); | ||
visual.transform.localPosition = Vector3.zero; | ||
visual.transform.localRotation = Quaternion.identity; | ||
visual.transform.localScale = Vector3.one; | ||
} | ||
|
||
void OnDrawGizmos() | ||
{ | ||
if (!Application.isPlaying) | ||
{ | ||
Gizmos.matrix = transform.localToWorldMatrix; | ||
switch (_primitiveType) | ||
{ | ||
case PrimitiveType.Sphere: | ||
Gizmos.DrawSphere(Vector3.zero, 1.0f); | ||
break; | ||
|
||
case PrimitiveType.Plane: | ||
Gizmos.DrawWireCube(Vector3.zero, new Vector3(10, 0.001f, 10)); | ||
break; | ||
|
||
default: | ||
// TODO | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Assets/VRM10/Samples~/ClothSample/ClothViewer/ClothVisualPrimitive.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.