- Home /
Creating a parabola (?) shaped zone of interaction...
So I want a zone of interaction originating from a object, but i don't want to use shapes with colliders that have simply been rendered invisible. I was thinking more pure maths? E.g.
Say you have a Player, and just draw a parabola from the player as a origin, cant u use it to create a sort of half dome?
I don't know if this makes sense, or maybe I'm way off as far as how this works. But I need the most performance efficient solution due to needing a lot of pawns present at the same time.
Answer by Hellium · May 13, 2019 at 11:14 AM
In your precise situation, I strongly recommend using a sphere collider with "filtering". Indeed, the physics engine is optimized (space subdivision, ...), and I don't think you have the possibility to "include" your custom collision detection algorithm.
Since you have a basic shape (half sphere), I guess you can do the following using a Sphere collider (set to trigger)
private void OnTriggerEnter(Collider other)
{
// Filter to keep half of the sphere
Vector3 direction = (other.transform.position - transform.position).normalized;
if( Vector3.Dot( direction, transform.forward ) > 0 )
{
// Do something
}
}
Answer by ivan866 · Jun 05, 2019 at 12:42 PM
Just solve an equation y=x^2 and see if your current position is higher or lower than the function's response value.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
VR Rigidbody not working with child colliders 0 Answers
WebGL Build bugged Colliders 0 Answers
physics.OverlapSphere colliders 1 Answer
kinematic trigger with static collider-no trigger message? 0 Answers