- Home /
The question is answered, right answer was accepted
Pulling an object inside the player
Hello everyone,
my question is how to pull an object inside the player (when he catch a star in the game, i want the star to scale down and go inside my player).
Thanks
the game is 2D and using JS
You can use a sphere collider. Attach a script to the sphere and use OnTriggerStay, you need to add a force to the object with the direction to the player and reduce its scale.
I would suggest you to destroy the star object after a certain amount of time (when it is no more visible because in the player) to lighten the workload.
Have you tried scaling it down with http://docs.unity3d.com/Documentation/ScriptReference/Transform-localScale.html and moving with like at http://wiki.unity3d.com/index.php?title=Click_To_$$anonymous$$ove ?
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Pick 2D object with touch in Unity 4.3 0 Answers
Reverse animation loop stops at frame zero 0 Answers
Networking When Offline 1 Answer
2D Animation does not start 1 Answer