Added rayheight for pickandthrow
This commit is contained in:
parent
a97dfe7049
commit
670ddee65a
|
@ -30,6 +30,9 @@ public class PickAndThrow : Script
|
||||||
[Tooltip("Lenght of ray")]
|
[Tooltip("Lenght of ray")]
|
||||||
public float rayDistance = 1;
|
public float rayDistance = 1;
|
||||||
|
|
||||||
|
[Tooltip("Height of ray")]
|
||||||
|
public float rayHeight = 0.1f;
|
||||||
|
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
pc = GetScript<PlayerController>();
|
pc = GetScript<PlayerController>();
|
||||||
|
@ -205,7 +208,7 @@ public class PickAndThrow : Script
|
||||||
{
|
{
|
||||||
Vector3 dirNor = pc.tranform.Forward;
|
Vector3 dirNor = pc.tranform.Forward;
|
||||||
Vector3 playerRayPos = pc.tranform.GlobalPosition;
|
Vector3 playerRayPos = pc.tranform.GlobalPosition;
|
||||||
playerRayPos.y += 0.25f;
|
playerRayPos.y += rayHeight;
|
||||||
dirNor.Normalise();
|
dirNor.Normalise();
|
||||||
List<RaycastHit> rayList1 = Physics.Raycast(new Ray(playerRayPos, Vector3.RotateY(dirNor, SHADE.Math.DegreesToRadians(22.5f))), rayDistance, false, (ushort)65535);
|
List<RaycastHit> rayList1 = Physics.Raycast(new Ray(playerRayPos, Vector3.RotateY(dirNor, SHADE.Math.DegreesToRadians(22.5f))), rayDistance, false, (ushort)65535);
|
||||||
List<RaycastHit> rayList2 = Physics.Raycast(new Ray(playerRayPos, Vector3.RotateY(dirNor, SHADE.Math.DegreesToRadians(-22.5f))), rayDistance, false, (ushort)65535);
|
List<RaycastHit> rayList2 = Physics.Raycast(new Ray(playerRayPos, Vector3.RotateY(dirNor, SHADE.Math.DegreesToRadians(-22.5f))), rayDistance, false, (ushort)65535);
|
||||||
|
|
Loading…
Reference in New Issue