Animated 3D Sprite
Blitz3D Forums/Blitz3D Beginners Area/Animated 3D Sprite
| ||
Does anyone have any sample code or something that can show me how to load a sprite in Graphics3D mode as an animation? Somewhat like LoadAnimImage. But with sprites and in Graphics3D. |
| ||
You can create a quad and add an animated texture to it.It's the same thing with a sprite. Here's the function to create a quad; Function CreateQuad(parent=0) sprite = CreateMesh() he = CreateBrush(255,255,255) v = CreateSurface(sprite, he) FreeBrush he AddVertex ( v, -3, 3, 0, 1, 0) AddVertex ( v, 3, 3, 0, 0, 0) AddVertex ( v, -3, -3, 0, 1, 1) AddVertex ( v, 3, -3, 0, 0, 1) AddTriangle ( v, 0, 1, 2) AddTriangle ( v, 3, 2, 1) FlipMesh (sprite) EntityParent sprite, parent Return sprite End Function |
| ||
But will it still have the alpha effects and everything? Do I need to have a transparent PNG texture file? |
| ||
LoadAnimTexture? |
| ||
@big10p:Thats what I said.But you need a quad you can't texture a sprite. @Ked:It will have alpha effects with proper flags my friend. You have to load your textures using, LoadTexture("Yourtexture.bla", 7) |
| ||
@big10p:Thats what I said.But you need a quad you can't texture a sprite. Someone's talking mince again ;) Assuming a 256 x 256 texture with 8 x 8 texture frames. MYsprite = createsprite() : scalesprite Mysprite,10,10 MYtexture = loadanimtexture( "Blah.png" , 2 , 32,32,0,31 ) Entitytexture MYsprite , MYtexture , Frame Where frame = 0 to 31. Stevie |
| ||
Argh, I quit... :D |
| ||
Stevie G wins! |
| ||
mine is working too :( pity me |
| ||
pit me OK then :) 1. createmesh has an optional parent param .. no need to do this manually. 2. mesh color is 255,255,255 by default .. no need to apply a brush. 3. if you create the vertices in clockwise order no need to use flipmesh. Function CreateQuad(parent=0) sprite = CreateMesh( parent ) v = CreateSurface( sprite ) AddVertex ( v, -3, 3, 0, 1, 0) AddVertex ( v, 3, 3, 0, 0, 0) AddVertex ( v, 3, -3, 0, 0, 1) AddVertex ( v, -3, -3, 0, 1, 1) AddTriangle ( v, 0, 1, 2) AddTriangle ( v, 2, 3, 0) Return sprite End Function |