Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / [Tier 1] Sprite animation on a 3D plane?

Author
Message
basicFanatic
6
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 16th May 2018 14:08
Is there any relatively easy way of doing this?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 16th May 2018 14:44
You can put your 2D Animated sprite offscreen and use a RenderImage to create the image. Then texture your 3D plane with the Render Image.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
basicFanatic
6
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 17th May 2018 14:59
Good solution, except that the VR plugin takes over the camera resolution. I think I try importing individual frames as a series of images!
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 17th May 2018 15:38
With Batvinks suggestion, it might get a little messy - it really depends it the workload is worth it.

If you are using this on a single object, then I'd be tempted to just make a shader to handle a sprite sheet image source. Like, set the UV coordinate for the desired frame - heck you could even use a vector, so XY the first corner of the sprite, and ZW the second corner. That way you'd apply a sprite sheet image to the object, and update a vector to set the actual image area to display. Adding animation frame by frame to that would be straightforward.

I could rustle up an example for you, wouldn't take long.
The code is dark and full of errors
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 17th May 2018 15:53
A shader isnt needed really to do this

Just set the UV offset and scale on a plane/rectangle object to show part of a sprite sheet. Once the scale is set correctly its only the offset that needs to change for each animation frame.
basicFanatic
6
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 18th May 2018 11:51
Hey Bengismo, that worked! Clever hack!

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-20 09:21:23
Your offset time is: 2024-04-20 09:21:23