- Home /
Is it possible to check which point is being touched?
Hello, guys. I'm coding with some primitive meshes such as sphere, cube, cylinder.
For now, I'm planing about game like billiard.
If I add force to specific mesh, the mesh checks which point is being touched and how many powers received. And the mesh goes to vector which is opposite vector of touch vector.
As I know, in Unity, objects check only whether it is touched or not by OnTriggerEnter or OnCollisionEnter and so on, but there isn't any functions which I planned.
Is anybody knows how to check which point is being touched in meshes? [If possible, I'd like to know absolute position in gameScene.]
(if image doesn't show up, http://imgur.com/9U33mo9)
THx for reading!
[1]: http://imgur.com/9U33mo9
You can solve this using Physics.Raycast(). There are a bizillion posts on Raycasting on UA.
@robertbu Thx for replying. But I think that raycast is only for forward direction, nor for left, right, nor back. However I'll check the raycast references. Thanks!
Raycast can go any direction you want. You can raycast any down the length of a cue for example to see where the cue is hitting (or will hit if it is not yet in contact). Alternately, you can get position information from OnCollisionEnter(). The Collision that is passed as a parameter in this callback contains an array of contact points in world space.
Your answer
Follow this Question
Related Questions
Tiny tag changing and checking problem 2 Answers
Sphere detection system 2 Answers
Check if player is on track 1 Answer
Check if collider is colliding with anything non specific? 1 Answer
script on monster checks if bool on attacking player = true? 2 Answers