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 - Gvrv89

Pages: [1]
1
Support / Re: Collision strange behaviour
« on: October 04, 2011, 12:42:14 pm »
Sorry for my mistake :P

Here are the links :

http://pastebin.com/96nxsZVZ [HelloWorldOGL.java]
http://pastebin.com/KCxLLmdi [TreeEngine.java]

EDIT :

I am thinking of a thing : Can I simply get axises mesh's point, thus I can set the Object3D.SetCenter() stick the the mesh's point (sorry for bad english).

2
Support / Re: Collision strange behaviour
« on: October 03, 2011, 10:34:52 pm »
Ok, thanks, I'll try it now.

And, yes, I put my tree above the ground to make sure the collision is computed.

I'll tell you if it works.

Nope, stille the same result...

I give you the new code :

http://pastebin.com/96nxsZVZ [HelloWorldOGL.java]
http://pastebin.com/96nxsZVZ [TreeEngine.java]

I'm giving up, if I don't succed, I put the trees by hand. :)
Nah, I'll play with variable settings tomorrow.

3
Support / Re: Collision strange behaviour
« on: October 03, 2011, 08:59:42 pm »
The problem is that the trees are floating above or under the terrain, depending the initialisation location.

dir is a SimpleVector(0, 1, 0).

I tried various values of this, nothing changes...

PS : Look at the zip attached to my previous post for more details.

Thanks.

4
Support / Collision strange behaviour
« on: October 03, 2011, 02:15:40 pm »
Hi all !

It's been two days I try to make collisions works. Unsuccessfully...

I load a 3ds terrain and want to stick 3ds trees on it.

Here's the project (simplified) : https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0B34S8VzVRdKMMGQxY2UwNDItNWM2OC00YzdkLTlmZmEtMjNjNDg3NmIwZWMz&hl=fr

The important code parts are :

Code: [Select]
ground = Loader.load3DS("res" + c + "ground.3ds", 70f)[0];
ground.rotateX((float) (-Math.PI / 2));
ground.translate(-100f, 10f, 2f);
ground.setSpecularLighting(true);
ground.setShadingMode(Object3D.SHADING_GOURAUD);
ground.setTexture("ground");
ground.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
ground.setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
ground.build();
world.addObject(ground);

And :

Code: [Select]
public TreeEngine(World world, Object3D ground)
{
char c = File.separatorChar;

Object3D tree = Loader.load3DS("res" + c + "tree.3ds", 3f)[0];
tree.setSpecularLighting(true);
tree.setShadingMode(Object3D.SHADING_GOURAUD);

trees = new Vector<Object3D>();
for (int i = 0; i < 25; i++)
{
trees.add(tree.cloneObject());
trees.get(i).rotateX((float) (-Math.PI / 2));
trees.get(i).rotateY((float) (-Math.PI / Math.random() * 2));
//trees.get(i).scale((float) Math.random() * 2f);
trees.get(i).setCenter(ground.getTransformedCenter());
trees.get(i).translate(new SimpleVector(Math.random() * 800f - 400f, 0, Math.random() * 800f - 400f));
trees.get(i).setCollisionMode(Object3D.COLLISION_CHECK_SELF);
trees.get(i).setCollisionOptimization(Object3D.COLLISION_DETECTION_OPTIMIZED);
trees.get(i).build();
world.addObject(trees.get(i));

dir = trees.get(i).checkForCollisionEllipsoid(dir, new SimpleVector(1, 1, 1), 1);
//System.out.print(dir);
trees.get(i).translate(dir);
}
}

Did your expert eyes seen something wrong on this ? :)

Btw I set "Config.collideOffset = 40;".

Thanks in advance.

Pages: [1]