# SPhysicsHit

**成员** 7

|      |                             |                                                           |
| ---- | --------------------------- | --------------------------------------------------------- |
| 属性 | [Object](#object)           | –                                                         |
| 属性 | [Position](#position)       | Where the physics hit occurred                            |
| 属性 | [Normal](#normal)           | The normal of the hit                                     |
| 属性 | [UV](#uv)                   | The UV coordinates of where the hit occurred on a mesh.   |
| 属性 | [UV2](#uv2)                 | The UV2 coordinates of where the hit occurred on a mesh.  |
| 属性 | [Distance](#distance)       | How far down a ray or from the collider, the hit occurred |
| 属性 | [ContainsHit](#containshit) | Whether it was a hit or not                               |

## 属性

### Object

[SGameObject ](/docs/zh-Hans/scripting/client-scripting-api-reference/types/sgameobject.md)Object {get; }

示例

**Lua**

```lua
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitGameObject = hit.Object

```

**Lua**

```lua
example 2

```

### Position

[SVector](/docs/zh-Hans/scripting/client-scripting-api-reference/types/svector.md) Position {get; }

Where the physics hit occurred

示例

**Lua**

```lua
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitPosition = hit.Position

```

### Normal

[SVector](/docs/zh-Hans/scripting/client-scripting-api-reference/types/svector.md) Normal {get; }

The normal of the hit

示例

**Lua**

```lua
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitNormal = hit.Normal

```

### UV

SVector UV {get; }

The UV coordinates of where the hit occurred on a mesh.

危险

This property will currently always return \[0,0] due to a current bug.

示例

**Lua**

```lua
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitUV = hit.UV

```

### UV2

SVector UV2 {get; }

The UV2 coordinates of where the hit occurred on a mesh.

危险

This property will currently always return \[0,0] due to a current bug.

示例

**Lua**

```lua
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitUV2 = hit.UV2

```

### Distance

float Distance {get; }

How far down a ray or from the collider, the hit occurred

示例

**Lua**

```lua
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitDistance = hit.Distance

```

### ContainsHit

bool ContainsHit {get; }

Whether it was a hit or not

示例

**Lua**

```lua
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitContainsHit = hit.ContainsHit

```
