- Home /
How do I create two colliding Spheres?
I created an animation of 2 spheres moving towards one another however, I want it to where once the 2 spheres touch one another, bounce back towards their respective wall, then bounce back again towards one another; so on and so forth. How would I do this?
Hello.
First, your title does not match with your problem...
I dont get what you want. A physic real collision? or just ana animation forward and back in loop?
Show us what you done to understand your problem, explain it better.
Thanks.
Answer by KonniosGames · Mar 02, 2020 at 07:26 PM
What I have in mind is that you have to create a script. (You also in to add rigid body and colliders in both objects). You need to create 4 variables( 2 for the rigid bodies components [public rigidbody myrigidbody;] and 2 for the animator components [public Animator myanimator;]). Then create a function [public void StopAnim() {
}]. Inside of that function you want to enable the Animators and disable the rigodbodies( you need to have the rigodbodies components disabled by default). Ok now attach the script to both objects and through the Inspector, tell the script what is animator and what rigidbody. The last thing you need to do is go to the last frame of the animation and add an animation event. From that event you need to call the previous function [StopAnim()].
Your answer
Follow this Question
Related Questions
Collision on specific Frames 1 Answer
How to create “broken glass” animation? 0 Answers
User can jam on the attack button and get the player stuck in the attack animation. 0 Answers
Animation with frozen player ?? 0 Answers
How to trigger different animations depending on where a gameobject collides? 1 Answer