Welcome Guest ( Log In | Register )

[ Big| Medium| Small] -



Post new topic Reply to topic  [ 5 posts ] 
    Xilef
  Fri Oct 05, 2012 4:36 pm
User avatar
Staff

Big Dumb Guy

Location: UK
I'm trying to get a sprite to tilt to face the camera in 3D space, at the moment I can get it to spin to face the camera (Rotate on the XZ) but I need it to tilt backwards to face the camera.

I have the:
X, Y, Z position of the sprite I want to face the camera.
X, Y, Z position of the camera.
Forward vector of the camera.
Rotation of the camera.

Where do I start? I can get it to spin to face the camera and that's about it so far.

EDIT: I can get it to lean back now, so all that's left is getting it to rotate so when the camera's facing downwards it doesn't look like all the sprites are leaning over (They're aligned to the screen still, need Z rotation).

The code is literally rotating the 4 vertices to match the camera's rotation.

Image


Top Top
Profile      
 

    Glitchfinder
  Mon Oct 08, 2012 4:18 pm
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
Technically speaking, you only need three vertices. I'm just not familiar enough with three dimensional programming to give a demonstration of it.

_________________

Just call me Glitch.


Top Top
Profile      
 

    Morphex
  Mon Dec 10, 2012 4:21 pm
Member

3 Vertices what do you mean? you need a Quad To Render a Sprite if I am no mistaken so you kinda need at least 6 vertices , 4 if you reuse 2 from one of the triangles, either way I don't get your question Xilef so, could you elaborate a bit more ? Also I don't get why you are rotating the quad, if you make your render render the 2D after the 3D they will always look correct no?

Also, the way I am seing you are trying to make a 2.5D engine (2D sprite on 3D backgrounds) I have a few tutorials here about that if you need help, also in what language are you coding this?


EDIT: WOW, I am a freaking IDIOT to not have looked at the Topic Date! I am sorry!

_________________
http://www.morphexe.com/Blog/4009/beta-testing-the-engine-online


Top Top
Profile      
 

    Glitchfinder
  Wed Dec 12, 2012 11:30 pm
BEWARE: Glitchfinder's sense of humor sucks.
User avatar
Staff

Party Mascot

Location: Approximately 93 million miles from Sol.
Morphex wrote:
3 Vertices what do you mean? you need a Quad To Render a Sprite if I am no mistaken so you kinda need at least 6 vertices , 4 if you reuse 2 from one of the triangles, either way I don't get your question Xilef so, could you elaborate a bit more ? Also I don't get why you are rotating the quad, if you make your render render the 2D after the 3D they will always look correct no?

Also, the way I am seing you are trying to make a 2.5D engine (2D sprite on 3D backgrounds) I have a few tutorials here about that if you need help, also in what language are you coding this?


EDIT: WOW, I am a freaking IDIOT to not have looked at the Topic Date! I am sorry!


I wasn't referring to vertices in terms of a quad. I was referring to them in terms of rotation. I actually should have said axes, but it's too late to go back and fix that now.

_________________

Just call me Glitch.


Top Top
Profile      
 

    Xilef
  Thu Dec 13, 2012 4:11 pm
User avatar
Staff

Big Dumb Guy

Location: UK
I'm going to add some closure to this old topic.
Rotate yz first then zx to get to the screenshot I have above, also in that shot I used the base of the sprites (Origin of the blob shadow) as the anchor point for rotation, I then displaced the vertices from that point into their correct 2D positions based on the XY plane before applying the rotation.
I do not suggest doing this for extreme angles like in the screenshot above, it looks stupid.

In stead, limit it to small angles of attack or consider using XZ aligned billboards. I believe super mario 64 uses the former, uglier method with it's tree billboards, but minecraft uses the latter method for the dropped items (Before they made them 3D spinning models).

Ragnarok online is a good example of the former method, in that game the angle of attack is actually locked at ~45 degrees.

In terms of my project, I'm reconsidering 3D models in stead of billboard sprites, I feel this project here shows why high-quality 2D graphics look stupid: [Days of Dawn]


Top Top
Profile      
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 


Who is online

Users browsing this forum: No users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

We are an independent, not-for-profit game making community.
Homepage
Board Index
About Us
Downloadable Games
Free Browser Games
Games in Development
RPG Maker Support
Game Maker Support
Construct 2 Support
HBGames the eZine
Advanced RPG Maker
Site Announcements
Powered by phpBB © phpBB Group