Hello,
I want to put a lot of “textures” (eg. spray, blood) in to mesh collider
I want to put at at the position that user click (no exact position) at it
(I use ScreenPointToRay to do this, so I already get the exact point of the Mesh Collider from my click at screen (name as sprayFar in below) )
this is the image to explain what the rotation I actually want
currently, I put texture in ( plane , sprite object) and generate it over the Mesh Collider
but now I can only place at the exact position, but can’t rotate it to the proper rotation (I want it to rotation of lookout of its face)
ps.
I already try something like this
ScreenPointToRay(Input.mousePosition), out ray) {
// this one have rotation as default, so it’s face always look to the front
Instantiate (sprayFar, ray.point, Quaternion.LookRotation(ray.point) );
// this one have rotation as lookat from mouse position so the plane will flip and you can see only its hip (also, rotation of the mouse position to the point also not the proper one)
nstantiate (sprayFar, ray.point, Quaternion.FromToRotation(sprayFar.position, ray.point) );
// this one have rotation as lookat from The Mesh Collider point to mouse position, so it’s just be able to flip their face to show (however, rotation not the proper again)
Instantiate (sprayFar, ray.point, Quaternion.FromToRotation(ray.point, sprayFar.position) );
// this one also not the proper one
Instantiate (sprayFar, ray.point, ray.transform.rotation);
}
*** I’m just start using unity only 1 weeks, so, if you would like to suggest, please, please please please write the exact function name or exact feature name ***
** I don’t know is it has any better way to get it, if you have any better way, please feel free to teach me ! (I also think, it must have the better way than this) **
*** something like if it can put as materiel, texture in game/script and exact position, please tell me ***
Thanks!