Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Snap mouse along oblique boxCollider

$
0
0
Hi, i try to create this but i have a problem when the boxCollider has a oblique position. I create the first wall and it has a boxCollider for all the length on one side. I create another wall and it has a sphere in one angle with sphereCollider, rigidBody and script with OnCollisionEnter ...Exit. This sphere follows my mouse with raycastHit and when sphere collide with boxCollider i use this code: if (...) { targetPos = new Vector3(myFw.raycastHit.point.x, myFw.raycastHit.point.y, myCollisionTarget.collision.gameObject.transform.position.z); gObjPvtOrigin.transform.LookAt(targetPos); } If my wall it has the rotation.y = 0 the horizontal snap, works very well...but the oblique and vertical have a problem (because targetPos it has only collision.position.z)... How do i create a snap with oblique boxCollider? I would like that my mouse, moved the wall along boxCollider, without problem if the box is vertical horizontal or oblique.... Please help me thanks!!

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>