Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411428 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 19, 2024, 02:07:23 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityTownhallForum IssuesArchived subforums (read only)Tutorials2D sprites in a 3D environment
Pages: [1]
Print
Author Topic: 2D sprites in a 3D environment  (Read 3318 times)
NathanielA
Level 0
**

Working hard to get Himeko Sutori ready


View Profile WWW
« on: June 20, 2015, 12:35:22 PM »

Hey everyone.  I'm new here and I'd just like to share with you one of the things I've been working on:  Getting 2D sprites to work in a 3D environment:




"In a traditional isometric RPG, switching sprites is pretty simple:  If the character is moving south, show his face; if he’s moving north, show his back.  That works because the player’s point of view is always from the same direction.  But what happens when the player’s view is arbitrary?"

The short explanation is that "I find the object’s front/back and right/left directions with a vector transformation of (0,0,1) and (1,0,0).  Then I find the direction from the camera to the object with a simple vector subtraction, and then I take a dot product, relative camera direction with the object’s front direction, and relative camera direction with the object’s side direction.  The absolute value of the dot product tells me whether the camera is more closely aligned with the front/back or right/left.  Then I check to see whether the dot product is positive or negative, to decide between showing the front or the back, or between the left or the right."

Got all that?  For full details, you can check out my entry at http://himekosutori.com/?p=232.  I did the work in UDK, but the concepts are not engine-specific.

Edit:  And sorry, can anyone tell me if there's a way to shrink the images?
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic