Have a blood splatter effect rotate with the object when instantiated, Unity

Daniel Kirwan
1 min readOct 12, 2021

Objective: Make sure that the blood splatter effect rotated along the surface of the object collider

I am using a RayCast to shoot at my enemies in this game and I will be using the surface normal of Hit position, to determine the rotation of the blood splatter.

When instantiating your game object you are given the opportunity to apply a rotation, normally you would just use Quaternion.Identity, which means you don’t really care about the rotation, just place my object. But it this case, I do case and I want to use the RayCast collision position for it.

Instead of Identity, I am making use of another method called LookRotation and using the RayCast surface normal as the rotation to use. This means that it will be perpendicular to the surface the collision was detected on. And that should be it for rotating an object with the RayCast hit position.

--

--