- Home /
Bullet hole decal does not rotate properly.
First of all , i have checked the forums for similar problems such as mine and could not find anything . My problem is unusual , my bullet hole decal rotates awkwardly , I mean that when i shoot a wall which is vertical , the bullet hole appears like it has been shot on a horizontal wall!? . These are the lines of codes used in the process
Instantiate(bullethole, hit.point, hitRotation);
if(Hit.collider.gameObject.CompareTag("Wall")){
Decals.transform.position = Hit.point;
var decalClone = Instantiate( Decals, Hit.point+(Hit.normal * DecalDis), hitRotation);
decalClone.transform.parent = Hit.transform;
Destroy(decalClone,8);
}
Thank you for your time.
What is "hitRotation"? Don't you want to use the normal (or its inverse) somehow when deciding which way the decal should face?
Another thing to check would be which way the decal faces at rotation (0,0,0).
Oh sorry i forgot about that lol , and also the rotation is 0 0 0
var hitRotation = Quaternion.FromToRotation(Vector3.up, Hit.normal);
Why are you moving that Decals
object to the hit position? Could that be the non-rotated decal you're seeing?
What kind of object do you use for your decal. If it is a Quad, you need to use Vector3.back ins$$anonymous$$d of Vector3.up in your rotation calculation.
Your answer
Follow this Question
Related Questions
adding sphere colider rotation movment changed 2 Answers
Common 2D Collider flip problem 4 Answers
Rotating a MeshCollider 0 Answers
How can I rotate a player proportionally over a mesh? 1 Answer