|
I'm on my unity (iPhone) learning curve and working on a arcade shooter game... I want to use a billboard/sprite prefab for weapon projectile. I will instantiate this prefab when the player presses the fire button. I would like the prefab to have the following characteristics:
Not finding much documentation on creating a billboard (sprite) based prefab but perhaps I not searching correctly. Can someone point me to documentation or provide some guidance? Thanks for any help!
(comments are locked)
|
|
Make a billboard mesh to use for your object and use a script with Transform.LookAt to make it look at the camera in every Update. As for doing sprite animation, search for sprite animation. (You'll probably find that putting all the animation frames into a single texture and using UV offsets to animate is a more common method to use than using separate images.)
(comments are locked)
|
|
This assumes you've put everything onto a texture atlas and you have 64 frames of animation... I wrote this while mildly drunk, and you'll need to put a transform.LookAt(camera.position) sort of dealio on it. I'm sure you'll figure it out :) You could easily make this work with any number of frames. I almost follow... but I'm still early in my learning curve. You have the line: renderer.material.mainTextureOffset = Vector2(xOffset,yOffset); What is 'render'? is this billboard object?
Sep 08 '10 at 12:40 AM
RSud
Renderer is the component that actually draws it, so i'm offsetting it per frame. You can specify a seperate renderer if you use a variable for it up top.. var rendererToOffset : Renderer; then.. rendererToOffset.material.mainTextureOffset = Vector2(xOffset,yOffset); // Better anyway because it removes get_component calls which are slow
Sep 08 '10 at 03:55 AM
jtbentley
(comments are locked)
|

This is not appropriate for this website. Put it on the forum.
That said, you do NOT want to use a sequence of files; you want to use a single texture and change the offset on it.
http://forum.unity3d.com/viewtopic.php?p=276656
@Jessy I'm not sure why you think this form of question is not appropriate here. It could be more focused sure, but it's not completely open or vague and fits okay into the framework on this site.
I agree, the question seemed appropriate enough. I would have given some basic billboarding information in my response.