Spawning a ragdoll with "on death" event for health script

sneekyo

Member
When you kill a monster in my game, I use the "on death" event for the health + attribute script to spawn a ragdoll of the monster, however the ragdoll always seems to spawn in at some weird angle, and not the angle of the prefab. What can I do about this? Thank you!

-S
 

ChristianWiele

Moderator
Staff member
How do you spawn the ragdoll? The health component spawns objects with the same position and rotation as the character/object it is attached to.
Code:
var spawnedObject = ObjectPoolBase.Instantiate(m_SpawnedObjectsOnDeath[i], m_Transform.position, m_Transform.rotation);
 

ChristianWiele

Moderator
Staff member
No, as you see in the code, it will always take the rotation of the character. Instead of spawning your ragdoll directly, you could write a spawner that spawns the ragdoll in whatever position/rotation you need it. Then you spawn an object with the spawner attached.
 
Top