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.

Messages - Ulrick

Pages: [1] 2
Support / Re: Get a pixel color from and object 3d texture?
« on: November 22, 2010, 10:48:59 am »
Ok, thanks, but just a consideration.

What if you have a plane where you have water, snow, rocks, dirts and green? What should you take into account when moving "dirts"?



Support / Re: How to do 2D click to 3D object picking?
« on: November 16, 2010, 03:54:11 pm »
I got your sample code from the Wiki (

SimpleVector dir=Interact2D.reproject2D3D(camera, frameBuffer, x, y);
int[] res=Interact2D.pickPolygon(world.getVisibilityList(), dir);

In res, you'll find the polygon- and the object number (in that order), if the picking actually picked something. If not, res is null. Your picked Object3D is now

(*) Object3D picked=world.getObject(res[1]);

But that works probably for the Desktop version of JPCT (I didn't tested it).

In JPCT-AE, doing the same, will just give a null pointer executing the marked (*) line of code

While casting to Object3D return the right value:

 Object3D picked=(Object3D)result[1];

I was writing just to be sure it was the correct way in JPCT-AE.



Support / Re: How to do 2D click to 3D object picking?
« on: November 16, 2010, 11:01:01 am »
Hi Egon,

just to be sure I'm doing it right, in JPCT-AE, if I use the following:

Object3D picked=world.getObject(result[1]);

I get always a null pointer.

while if I use the following:

 Object3D picked=(Object3D)result[1];

I get it right.

Is it correct?



Projects / Re: Projects anyone?
« on: November 12, 2010, 10:10:25 pm »
Hi, mine is still a prototype.

Still issues with memory and object size, but you can see screenshots and download a sample version.

No idea on how to handle a bigger ground environment, If I do it it will just slow down the application.

No way to add more objects (still if some would be nice to have).

Some issue with decal orientation on the ground and an open issue with the particle system that would be nice to get textures from collide objects.

Any idea is welcome.


Thanks to Egon

Support / Re: Get a pixel color from and object 3d texture?
« on: November 12, 2010, 11:55:58 am »

you are right, probably is better explain my case.

what I would like to do is to implement a particle system that creates "dirt" when a surface is hit by (i.e.) a missile.

In that case, would be nice to have some particle present a portion of the texture of the original Object been hit.

Is there a way to implement it? As I cannot find a way to get the texture used by an object and as I cannot get portion of it, what could be a nice solution for this kind of issue?

Thanks a lot Egon,



No solution for this ?

Thanks Egon

Support / Re: Get a pixel color from and object 3d texture?
« on: November 12, 2010, 10:38:42 am »
What about something like this?

SimpleVector Point22D =  Interact2D.project3D2D(camera, FrameBuffer, PointOfImpact);

int IntColor=FrameBuffer.getPixel(Point22D.x, Pint22D.y); //   this function is just missing, but would be usefull. The getPixels
                                                                             //   just take too long and get too many             
                                                                             //   not-required data.

RGBColor PixColor = new RGBColor(  (IntColor>> 16) & 255, (IntColor>> 8) & 255, IntColor & 255);

Iti shouldn't be difficult to write a function like the getPixel (x,y) that will be faster than the getPixels().

With that, it should be possible to get it nearly right.

What do you think?



Support / Get a pixel color from and object 3d texture?
« on: November 11, 2010, 05:28:01 pm »
Hi Egon,

I cannot find information regarding this matter on the forum, so I write this.

Is there a way to get a pixel color from an Object3D? It would be nice to have it when colliding two object, get the color of the collision point and/or some points with a coordinate system.

Thanks in advance,


Support / Re: MD2 animation
« on: October 30, 2010, 12:11:08 am »

I thought it was correct. As you probably understood, I just started using blender
, so I probably missed something.

Anyway the animation looks correct and there are no issues with backface as far as I understood (sorry, but I actually didn't understand what you mean by activating backface culling).

what software do you use to check md2 files?

Thanks anyway,


Support / Re: MD2 animation
« on: October 29, 2010, 05:10:26 pm »

then go to this web site (my own) and get bougth files you see there:

One is the md2 and the second one is the texture.

Forgot to place the .blend (just added).

Thanks a lot,


P.S. btw if you go to this web site you can see what I'm working on

Support / Re: MD2 animation
« on: October 29, 2010, 03:38:33 pm »
Thanks EgonOlsen, it is a simple MD2 I made with Blender.

What do you mean by "set the clamping mode to wrapping"?

Is it a JPCT command? I cannot find it.

Thanks a lot,


P.S. if you want I can post a link to download it

Support / MD2 animation
« on: October 28, 2010, 05:42:53 pm »
Hi all,

as I can read from the documentation, the animation method of an Object 3d, should be used as follow:

public void animate(float index)

    Calculates a new mesh for this object based on the keyframes of its animation sequence and "index". index is a value between 0 and 1 where 0 is the first keyframe and 1 the last. Because no sub-sequence is indicated, the complete animation will be used.

        index - the "time-index" into the animation

So 0 is the first keyframe and 1 is the lastone.

In my case, it seems not to work correctly. 0 seems to be ok, but as for the last keyframe, seems like 1 is not correct as my animation seems actually to freeze for a while and then restart. If I lower the limit value to something around 0.32 o 0.34 it seems to work correctly (not really but it is better).

Can anyone give me some hints on how to use it?

Thanks a lot,


Support / Re: Info on calcAngle on SimpleVector
« on: October 27, 2010, 12:57:31 pm »
Thanks paulscode,

the one I made work great!!.

Thanks again,


Support / Re: Info on calcAngle on SimpleVector
« on: October 22, 2010, 03:19:36 pm »
You are right, but do you think could be possible to add also a direction vector in calcAngle in order to have a 360 degree angle evaluation?

What I actually need is to get a space orientation in the 3D world of an object. This is needed to have a correct rapresentation of a map view when moving in all direction of the surrounding elements.

As an example, image to have a space game where a ship can move in any direction, How do you represent a radar view of enemy ships? imagine that you could be upside down or on one side while moving in space.

-- Update --
Actually, would be interesting, and I believe usefull, to have an extended class of the SimpleVector witch take into account also the direction vector.

-- Update2 --

After the suggestion of EgonOlsen and the description on how does it work, I found out a possible work around, but I will need to work on it to make it in one step.

What I do is the following:

SimpleVector V1=plane.getTransformedCenter();
SimpleVector V2=cam.getDirection();
float Angi= (float) (Math.atan2(V1.normalize().z,V1.normalize().x)-Math.atan2(V2.normalize().z,V2.normalize().x));

This should work for me. Do you think it is ok? The radar view is just a "top view" of the area and surrounding elements are displayed smaller if at a lower altitude or bigger if higher.         

Anyway both of you gave me already a good hint to start on.

Thanks a lot,


Support / Info on calcAngle on SimpleVector
« on: October 21, 2010, 06:13:54 pm »
Hi all,

just a quick question.

Probably in known to everyone, but I cannot understand why calcAngle return a 180 degree angle (I mean values from 0 to 180).

It could be possible to have it 360 degrees (means from 0 to 360)? or from -180 to +180?  Otherwise, how can I calculate angles from 0 to 360 between two SimpleVectors?

Probably I missed something.

Thanks in advance,


Support / Re: Not able to clear the data
« on: October 15, 2010, 10:04:44 am »

I actually have a similar problem.

In my case, I load everything and it work perfectly at every run, but now I would like to change loaded object while the application run, but I have problems when I try to free memory.

In my case I don't want to clear the world object, but just "unload" some 3d objects and textures and load some new objects.

As far as I unload Textures, it works fine with the memoryhelper in cleaning memory, but it seems that 3d objects are not cleaned (actually the test I did was to load a 3d object, than unload it and load a new one, but I get out of memory exception (in the test, it is not the only object I have in the world, actually used memory is already at the limit when loaded the first 3d object and I need to unload it to loa a new one, because just loading the new one give the out of memory exception).

I tried already to invert the loading in order to be sure that was not a problem with the second object, and it works.

To make things clearer, my case is that for example I have 10 objects loaded with memory usage at the limit. One object more fire the out of memory, so I need to unload one object in order to load a new one.

How can I unload an object? Am I doing something wrong?



Pages: [1] 2