I'm making a game and the current script uses transform.RotateAround to move in a circle around another game object. The down side of this is that the game object moving will go through other Trigger colliders, making it useless against another set coding I have. I need some way to manipulate the rigid body by converting Transform.RotateAround.
Coding:
var degree: float = Input.GetAxis("Horizontal") * speed * Time.deltaTime;
transform.RotateAround (Target.position, Vector3.up, -degree);
//Moves towards the target or away depending on up or down key
var translate: float = Input.GetAxis ("Vertical") * speed * Time.deltaTime;
rigidbody.AddForce(0, 0, translate * 50);
Trigger Script:
function OnTriggerEnter(other: Collider){
if(other.gameObject.CompareTag("Wall")){
rigidbody.velocity = -rigidbody.velocity;
}
}
For the trigger: You don't need triggers to bounce stuff off though. Just use a regular collider without any renderer. You can set layermasks so it only affect the ball if you want. Finally you could apply a bouncy physics material to it so it bounces right off.
For the controls: I toyed around a bit with this. See if this is somewhat like you expect.