fix raycast for player
This commit is contained in:
parent
ebf2bb8d85
commit
daad6699f1
|
@ -28,11 +28,6 @@ public class PickAndThrow : Script
|
||||||
public bool throwItem = false;
|
public bool throwItem = false;
|
||||||
private Vector3 prevTargetOffSet;
|
private Vector3 prevTargetOffSet;
|
||||||
|
|
||||||
public GameObject silhouettePlayer;
|
|
||||||
public Renderable silhouettePlayerRend;
|
|
||||||
public GameObject silhouetteBag;
|
|
||||||
public Renderable silhouetteBagRend;
|
|
||||||
|
|
||||||
[Tooltip("Lenght of ray")]
|
[Tooltip("Lenght of ray")]
|
||||||
public float rayDistance = 1;
|
public float rayDistance = 1;
|
||||||
|
|
||||||
|
@ -231,6 +226,7 @@ public class PickAndThrow : Script
|
||||||
if (pc != null)
|
if (pc != null)
|
||||||
{
|
{
|
||||||
Vector3 dirNor = pc.tranform.Forward;
|
Vector3 dirNor = pc.tranform.Forward;
|
||||||
|
dirNor = new Vector3(-dirNor.x, -dirNor.y, -dirNor.z);
|
||||||
Vector3 playerRayPos = pc.tranform.GlobalPosition;
|
Vector3 playerRayPos = pc.tranform.GlobalPosition;
|
||||||
playerRayPos.y += rayHeight;
|
playerRayPos.y += rayHeight;
|
||||||
dirNor.Normalise();
|
dirNor.Normalise();
|
||||||
|
|
|
@ -230,8 +230,6 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
if (hitResult.distance < pivot.armLength)
|
if (hitResult.distance < pivot.armLength)
|
||||||
{
|
{
|
||||||
SHLOG_INFO("WHAT CAMERA HIT: {}", hitResult.entityHit);
|
|
||||||
|
|
||||||
SHVec3 newOffset{ 0.0f,0.0f, 1.0f };
|
SHVec3 newOffset{ 0.0f,0.0f, 1.0f };
|
||||||
newOffset = SHVec3::RotateX(newOffset, -(SHMath::DegreesToRadians(pivot.GetPitch())));
|
newOffset = SHVec3::RotateX(newOffset, -(SHMath::DegreesToRadians(pivot.GetPitch())));
|
||||||
newOffset = SHVec3::RotateY(newOffset, (SHMath::DegreesToRadians(pivot.GetYaw())));
|
newOffset = SHVec3::RotateY(newOffset, (SHMath::DegreesToRadians(pivot.GetYaw())));
|
||||||
|
|
Loading…
Reference in New Issue