playMaker

Author Topic: Face cast - like raycast, but casts a square  (Read 3840 times)

Kubold

  • Full Member
  • ***
  • Posts: 112
Face cast - like raycast, but casts a square
« on: March 24, 2014, 09:30:01 AM »
Hi,

Is it possible to do a Facecast, that would work exactly like Raycast Action, but casted Faces with custom size, instead of rays or spheres?

The only thing: there should be 2 HitPoint variables: One of them should point to actual intersection of the Face and geometry it hit. The other variable should point to the center of the Face in the moment of hit.

Thanks!

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Face cast - like raycast, but casts a square
« Reply #1 on: March 24, 2014, 09:37:03 AM »
I don't see anything in the Unity Scripting Reference for a facecast, otherwise we could just make an action for it. Is it some custom thing you have used before?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Kubold

  • Full Member
  • ***
  • Posts: 112
Re: Face cast - like raycast, but casts a square
« Reply #2 on: March 24, 2014, 10:22:33 AM »
Yes, but not in Uniy. For camera anti-wall clipping. Every frame, I casted a face. If it collided with a wall, the camera was moved on local Z axis to the center of the face.

The point was, that if you did it on raycast, the camera ended up in the wall anyway, if the angle of hit was very small (see picture attached). This is caused by NearClip distance - the larger it is, the bigger the problem.

If Unity doesn't have this, I'll just work aroud it, with 4 raycasts or something. Unless somebody already figured it out and wants to share :)

Thanks!
« Last Edit: March 24, 2014, 11:06:19 AM by Kubold »