- Home /
Question by
torak289 · Dec 17, 2014 at 10:11 PM ·
transform.rotatearound
How to Limit Rotation
I have setup this swing trap but playing around with the rotation system I can't seem to limit the rotation as if it was swinging and not just rotating which it is currently doing. here is a video to show what it is currently doing.YouTube Video
Here is the script I have currently setup I am about to try Euler Angles, to see if that works and help would be fantastic:
using UnityEngine;
using System.Collections;
public class swingingAxe : killManager
{
void Update ()
{
Vector3 centerPoint = collider.bounds.center;
transform.RotateAround (centerPoint, Vector3.right, 2);
}
void OnTriggerEnter (Collider col)
{
if (col.tag == "Player")
{
Debug.Log ("DIE");
Die ();
DestroyObject (col.gameObject);
}
}
}
Comment
Best way to limit is $$anonymous$$athf.clamp...try it ....
Your answer
Follow this Question
Related Questions
Can you simulate the behavior of Transform.RotateAround using a Rigidbody? 0 Answers
Rotate around moves object out of position, why? 1 Answer
transform.RotateAround does not rotate to the object I want 2 Answers
Wheels that just plain won't spin 0 Answers
How to limit the rotation of an object 2 Answers