OLD_STEP_LIST_EDITOR
Documentation for the Unity C# Library
Loading...
Searching...
No Matches
CollisionUIVisualiser.cs
Go to the documentation of this file.
1
using
PixoVR.Core
;
2
using
System;
3
using
System.Collections;
4
using
System.Collections.Generic;
5
using
UnityEngine;
6
using
UnityEngine.UI;
7
8
public
class
CollisionUIVisualiser
: MonoBehaviour
9
{
10
public
GameObject
CollisionPrefab
;
11
12
private
void
Awake
()
13
{
14
EventBetter
.Listen(
this
, (
CollisionMessage
msg) =>
DrawCollision
(msg.
reporter
, msg.
collision
));
15
}
16
17
private
void
DrawCollision
(Collider reporter, Collision collision)
18
{
19
var vis = GameObject.Instantiate(
CollisionPrefab
, transform);
20
var camera = Camera.main;
21
22
var screenPoint = camera.WorldToScreenPoint(collision.contacts[0].point);
23
vis.transform.position = screenPoint;
24
vis.GetComponent<Text>().text = reporter.name +
" with "
+ collision.gameObject.name;
25
}
26
27
}
CollisionMessage
Definition
CollisionReporter.cs:22
CollisionMessage.reporter
Collider reporter
Definition
CollisionReporter.cs:23
CollisionMessage.collision
Collision collision
Definition
CollisionReporter.cs:24
CollisionUIVisualiser
Definition
CollisionUIVisualiser.cs:9
CollisionUIVisualiser.CollisionPrefab
GameObject CollisionPrefab
Definition
CollisionUIVisualiser.cs:10
CollisionUIVisualiser.Awake
void Awake()
Definition
CollisionUIVisualiser.cs:12
CollisionUIVisualiser.DrawCollision
void DrawCollision(Collider reporter, Collision collision)
Definition
CollisionUIVisualiser.cs:17
PixoVR.Core.EventBetter
Intentionally made partial, in case you want to extend it easily.
Definition
EventBetter.cs:20
PixoVR.Core
Definition
EventBetter.cs:14
com.pixovr.coreunitysdk
Samples
EventBetter
Collisions
CollisionUIVisualiser.cs
Generated
Wed Oct 9 2024 19:24:02
by Doxygen version
1.10.0