I was recently asked how to manually move a Jelly Sprite after the game had started. This isn't entirely trivial - you will find that you can't simply modify the Jelly Sprite's position (either by dragging it in the scene view or by modifying its transform in code), as it will immediately reset itself back to its previous position.
The reason for this is that each Jelly Sprite is composed of lots individual physics bodies (known as 'Reference Points'), which are used to determine how the Jelly Sprite should move and deform. These Reference Points are kept separate from the Jelly Sprite GameObject, which is automatically updated each frame to match the position of the central Reference Point (the rest of the Reference Points are used to calculate how to deform the mesh). Therefore, if you want to move the Jelly Sprite, you actually need to move the Reference Points, not the sprite itself.
If you're doing this in the scene view, just look for a GameObject called something like 'xxx Reference Points' (with 'xxx' being the name of the original Jelly Sprite GameObject) - you can move this to move move the Reference Points, and the sprite will follow.
I've also written a bit of code that will move a Jelly Sprite to a given position by altering the position of its Reference Points - hopefully this is of use to some people! I'll make sure that I include it in the next update as a SetPosition() function.
Pages
Jelly Sprites is a soft-body physics system for Unity sprites, It allows you to quickly and easily convert static sprites into ones that will bounce, stretch and deform, naturally reacting to physical forces in your game.
Wednesday 12 February 2014
Rotation Fix
Thanks to the guys on the Unity Forums that spotted that Jelly Sprites would automatically rotate back to zero degrees whenever the game started, even if you had set a different rotation in the inspector. If you upgrade to version 1.18 (now live in the Asset Store) then the problem should be fixed!
Monday 20 January 2014
1.16 Update
The Jelly Sprites 1.16 update is now live on the Unity Asset Store! This update contains a number of significant performance optimisations, along with the ability to add attach points at runtime.
Sunday 12 January 2014
Jelly Sprites Website Live!
Welcome to the Jelly Sprites website! I'll keep this page updated with news on new updates, features and other improvements. Please check out the 'User Guide' page for more info on the plugin and video tutorials.
Subscribe to:
Posts (Atom)