Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - tollos

#1
Okay I'll try that, thanks ;-)
#2
Support / Re: first person and thrid person
June 13, 2013, 04:46:31 PM
Just change the camera position and maybe disable the car itself for first person view for performance, you shouldn't need anything more ;-)
#3
Arg it's gonna be hard ...
Maybe if you could give me a little advice on how to implements it then, it would be very nice ;-)

In the attached picture you can see what I intend to do

In the first you can see the 2 objects I want to move (A&B) and the pivots I have (1&2).
In the second one, it's what I have now, when I rotate the object A around pivot 1, I also rotate object B around pivot 1 so it's at the correct position.
What I want is the third one, after the first rotation for the position, I want to rotate it back to vertical position around pivot 2.

I think that by moving B to the correct position instead of rotating it should do the trick but no idea how ...  ???

I hope it's clear and that you have an idea how I could implement it.

Thanks in advance !



[attachment deleted by admin]
#4
Support / Multiple rotations on different pivots
June 13, 2013, 12:53:43 PM
Hello Egon,

Just a little question about multiple rotations with multiple pivots on the same object.

I'm first setting a pivot, do a rotation then I'm changing the pivot and do another rotation but it seems that both rotations uses the last pivot I provided.

Is it intended ? If so, how could I do to resolve this issue ?

Thanks in advance!

#5
Support / Re: Rotation on group of objects
June 13, 2013, 11:04:57 AM
Forget about it, by adding all my model's parts to the reference one (the head) as addChild() it works perfectly for movement and rotations ;-)
#6
Support / Rotation on group of objects
June 12, 2013, 05:28:54 PM
Hello,

I'm currently working on my own animation module for my game. Very simple stuff with only textured rectangles and pivot nodes.
I don't want to use Bones or any other tool, the objective is to make mine ... and to avoid using any 3D modeling tools since I'm totally bad at modeling  ;-)

My problem is about rotations. If I have a character with head, torso, legs, arms, ... and I need to perform a rotation on the whole character I have no idea how to do it (without using setChild()).
I have a "main" object, the head in this case and this one turns perfectly with something like that :


Matrix mat = new Matrix( target.calcSub( head.gettranslatedCenter()).normalize()).getRotationMatrix() );
head.setRotationMatrix(mat);


But my problem are the other Object3D of the model, if I apply the same they just turn to the correct direction on their center axis but without moving of course.
I was thinking about a rotation on the Y axis, but no idea how to compute the angle they should turn.

Thanks in advance !



#7
Okay tried it and it looks way better now, back to lightning !   :o

Not perfect yet ... and won't be since I ignore the normals ... but it's already very nice for interriors.

Again, many thanks for your quick answer ;-)
#8
Yes I know, but nothing is generated with a modeler (Never used one before) , everything is done by code.

Finally I managed to understand the shaders and did one not based on normals but only affected by the distance to the light sources but ... still not okay since shaders are working by vertex to compute the distance to the light, I still have strange effects on texture.

Anyway, thanks for your quick support ;-)

By the way is someone is interested, this is the shader I made to test, only lightsources diffuse value affects the lightning and no normals are used.

Vertex Shader:

varying vec3 lightDir;
varying float att[gl_MaxLights];

void main()
{
vec3 vVertex = vec3(gl_ModelViewMatrix * gl_Vertex);
int i;
for (i=0; i<gl_MaxLights; ++i) {
lightDir = vec3(gl_LightSource[i].position.xyz - vVertex);
float d = length(lightDir);

att[i] = 1.0 / ( gl_LightSource[0].constantAttenuation +(gl_LightSource[0].linearAttenuation*d) +(gl_LightSource[0].quadraticAttenuation*d*d) );
}

gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
}


Pixel Shader:

varying float att[gl_MaxLights];
uniform sampler2D colorMap;

void main (void)
{
vec4 final_color;
int i;
for (i=0; i<gl_MaxLights; ++i) {
if(att[i]>0) {
final_color = final_color + ( gl_LightSource[i].diffuse * att[i] * texture2D( colorMap, gl_TexCoord[0].st ) ) ;
}
}

gl_FragColor = final_color;
}

#9
Thanks for your help !

I tried it but even if it's good for exteriors, it's not good for interiors. I think I will stick with "no lights" policy for now ;-)

#10
You can find the screenshot bellow, the ground here is made of some box, should have the same shading but you can clearly see the difference.

Maybe changing the normal of all cubes could help it but no idea how to do it ;-)

Also another little question about lights ... if I put a light high like a sun and then render an interior scene, the light is still applied inside the building, does that means there are no collision test for light rays ?

BTW ... the 8-bit retro style is what I want ;-)

Thanks for your help !

#11
Support / Shader based on distance from lightsources
January 08, 2013, 11:11:27 AM
Hello,

Currently my game don't have any lightning (except the ambiant one) and I would like to add some.
Problem is that it's block-based, not a single loaded object, and due to the vertex based lightning, it looks horrible when I try.

I tried to use shaders but being totally new with them it's a bit difficult to get something nice ;-)

What I need is shaders that works on multiple light sources (maybe even colored but that's not mandatory) and based on distance but not on normals ... and that don't go trough walls if possible.

Does someone have a shader that could fit that need ?

Thanks in advance !
#12
Support / Re: Camera and texture problem
December 13, 2012, 04:54:13 PM
Yes but it's only working in big rooms, if I put it with a big ellipsoid on corridors the camera is moving in a not nice way.

I found a workaround ... I put setCulling(false) to the level when i'm indoor, it's not fixing the problem but at least the players cannot peak trough a wall to see the end of the level.

#13
Support / Camera and texture problem
December 12, 2012, 03:52:43 PM
Hello there,

I'm currenly porting one of my old games in 3D and I'm reaching a small problem with cameras and textures.
It's a 3rd person game so the camera follows the hero.

I put a simple mechanism using checkCollisionElipsoid with a rotation on X axis to look a bit up/down :

                    // perso.sprite.getMain() returns the head which is the parent object of the character

                    cam.setPositionToCenter(perso.sprite.getMain());
            cam.align(perso.sprite.getMain());           
            cam.rotateX(totalRotationX);

           
            world.checkCameraCollisionEllipsoid(Camera.CAMERA_MOVEOUT, ellipsoidCam, 10, 8);
            world.checkCameraCollisionEllipsoid(Camera.CAMERA_MOVEUP, ellipsoidCam, 1, 5);


It's working fine for outdoor levels but while rendering an indoor level, I have a lot of time the camera going "out of the wall" and I can see behind the texture like in the second screenshot.
The first screen shot is when the camera is normal, the second is when the character is close to a wall and I rotate the camera to the right.

Is there a way to avoid that ?

Thanks in advance !