Rachel Dockter
Rachel Dockter

Reputation: 986

Lock a childs rotation so its always facing down

i have a 2d head that has just been cut off. Theres a particle effect of blood where it was connected to the neck so that point is always the same.

Now the head is starting to spin and as the particle effect is a child of the head, the blood is spinning with it.

Locking the rotation doesn't seem to work, it locks the rotation but I always want the blood to be dripping vertically down. Something like how a big wheel ride is spinning while the carts are always facing down.

This is what i tried for locking, the world and local rotation:

bloodTrailEffect.transform.eulerAngles = new Vector3(90, 0, 0); 
bloodTrailEffect.transform.localEulerAngles = new Vector3(90, 0, 0); 

Ive tried to capture a picture of what i mean:

enter image description here

So that trail of blood should be straight down. If it spins anymore, the trail starts to actually accelerate up which looks abnormal.

Upvotes: 3

Views: 71

Answers (2)

Horothenic
Horothenic

Reputation: 678

I am pretty sure there is an option on the Particle System that makes the particles world space, have you tried this?

Upvotes: 0

Fredrik Widerberg
Fredrik Widerberg

Reputation: 3108

I tried reproducing it myself, i has a spinning sprite, attached a ParticleSystem to to top middle of the sprite. Then i attached this script to the ParticleSystem

using UnityEngine;

public class KeepRotation : MonoBehaviour {

    Quaternion rotation;
    void Awake()
    {
        rotation = transform.rotation;
    }
    void LateUpdate()
    {
        transform.rotation = rotation;
    }
}

It just keeps setting the original rotation back..

Upvotes: 1

Related Questions