Camera problems
4 posters
Camera problems
I am totally new to OpenGL and blender, so this might be a stupid question. I need to do a mostly 2D game, with a top view mode (that is, stuff is seen from above). What I did was create a camera in the origin, elevate it on the 'z' axis and set it as orthografic (I don't need perspective). I then put an object right under the camera so that with camera view in blender I can see it. When I export the scene and render it mostly like tutorial 2 I get nothing (if I just try tutorial02.sio2 it works instead).
What is the best way to accomplish what I am trying to do? For some reason even resetting the camera to "perspective" (which worked at first, although with a strange rotation) does not seem to help anymore.
What is the best way to accomplish what I am trying to do? For some reason even resetting the camera to "perspective" (which worked at first, although with a strange rotation) does not seem to help anymore.
michele.balistreri- Posts : 5
Join date : 2008-10-21
Same problem
I have exactly the same problem.
It seems that having x & y both zero for the camera direction makes the scene disappear. You can test this by just setting the camera direction to (0,0,1) For now I'm working around it by just orienting my entire scene and camera in blender so it's not viewed this way. Seems that some camera transformation in sio2CameraRender is not working if x & y are zero to me.
It seems that having x & y both zero for the camera direction makes the scene disappear. You can test this by just setting the camera direction to (0,0,1) For now I'm working around it by just orienting my entire scene and camera in blender so it's not viewed this way. Seems that some camera transformation in sio2CameraRender is not working if x & y are zero to me.
unclej- Posts : 1
Join date : 2009-01-29
Re: Camera problems
If you want to do a 2D game you do NOT need to use the Camera... simply set manually an orthographic view (sio2Enter2D / sio2Leave2D) and render your sprite / object manually...
The camera negative axis will negate its direction and the "Orthographic" toggle in Blender is NOT supported by SIO2...
The current camera and culling system is 3D based, if you plan to do 2D games you'll have to implement theses things yourself as SIO2 is a 3D engine, but still have 2D functionalities (mainly use for HUD etc...).
However you do have all the base that you need in order to create 2D games but extra work is required compare to 3D...
The camera negative axis will negate its direction and the "Orthographic" toggle in Blender is NOT supported by SIO2...
The current camera and culling system is 3D based, if you plan to do 2D games you'll have to implement theses things yourself as SIO2 is a 3D engine, but still have 2D functionalities (mainly use for HUD etc...).
However you do have all the base that you need in order to create 2D games but extra work is required compare to 3D...
Re: Camera problems
There is something wrong with the camera export. Try to position a camera in Blender, looking down from above, and export it.
Best,
-joshua
Best,
-joshua
meteors- Posts : 241
Join date : 2008-11-08
Location : Sunny Florida
Re: Camera problems
My personal solution to this was just to re-orient my game so that the X-axis is up.
A hack, but a pretty good one considering the alternatives.
Best,
-joshua
A hack, but a pretty good one considering the alternatives.
Best,
-joshua
meteors- Posts : 241
Join date : 2008-11-08
Location : Sunny Florida
Re: Camera problems
This is not a good solution, simply use the old sio2LookAt:
Use the same parameters as for gluLookAt...
- Code:
void sio2LookAt( vec3 *_e,
vec3 *_c,
vec3 *_u )
{
float m[ 16 ];
vec3 f,
s,
u;
sio2Vec3Diff( _c, _e, &f );
sio2Normalize( &f, &f );
sio2CrossProduct( &f, _u, &s );
sio2Normalize( &s, &s );
sio2CrossProduct( &s, &f, &u );
memset( &m[ 0 ], 0, 64 );
m[ 0 ] = s.x;
m[ 4 ] = s.y;
m[ 8 ] = s.z;
m[ 1 ] = u.x;
m[ 5 ] = u.y;
m[ 9 ] = u.z;
m[ 2 ] = -f.x;
m[ 6 ] = -f.y;
m[ 10 ] = -f.z;
glMultMatrixf( &m[ 0 ] );
glTranslatef( -_e->x, -_e->y, -_e->z );
}
Use the same parameters as for gluLookAt...
Similar topics
» ogv problems
» Problems with the emitter tutorial
» Problems getting the engine
» Physics problems
» ObjectDuplicate problems
» Problems with the emitter tutorial
» Problems getting the engine
» Physics problems
» ObjectDuplicate problems
Permissions in this forum:
You cannot reply to topics in this forum