- Home /
Question by
dylanboots · Mar 26 at 04:45 PM ·
collision
lock Position and rotation on collision
I am Trying to make a pool game and would like to lock the position and rotation of the cue after it hits the ball. What I have tried locks the position and rotation of the X on start, Which I don't want it to do, and does nothing to the X, Y, or Z on the collision.
please help me out,
thank you for your time
public Rigidbody m_CueRB;
void Start()
{
m_CueRB = GetComponent<Rigidbody>();
}
void OnCollisionEnter()
{
m_CueRB.AddForce(transform.up * 0);
m_CueRB.constraints = RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotationZ;
m_CueRB.constraints = RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezeRotationY;
m_CueRB.constraints = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezeRotationX;
}
Comment
Your answer
Follow this Question
Related Questions
Make AI run from Player 1 Answer
How do I use collisions for player/enemy interaction 2 Answers
OnCollisionEnter question.... 1 Answer
spawning on collision 1 Answer