Show Posts
|
|
Pages: [1] 2
|
|
2
|
Game Development / Game Mechanics / Re: phys2d question: why is my gravity backwards...
|
on: 2007-12-04 05:37:00
|
What graphic API are you using ?
For the demo, it is java2D. The Y axis is up to down. If you use an opengl binding, the "Y" axis is down to up. It all depend on how you do the binding betwen the physis object and the rendering.
oh i see~ im using java3D... i think i get it... different graphic API have different Y axis representation...
|
|
|
|
|
3
|
Game Development / Game Mechanics / Re: phys2d question on iterations
|
on: 2007-11-28 07:58:54
|
i found out more about iterations... if you have a iteration of 1, very little force is produced when 2 bodies collide - even if both bodies have a restitution of 1.0f i tested it out on my program, using 1 ball bouncing on a body and another ball bouncing on a staticbody... apparently i had to increase the number of iterations to 10 to achieve a similar collision result from both balls... __________________________ in other words, the number of iterations determine the accuracy of the force produced from a collision between 2 bodies. is my understand correct...? feedback appreciated. 
|
|
|
|
|
4
|
Game Development / Game Mechanics / phys2d question: why is my gravity backwards...
|
on: 2007-11-28 07:22:58
|
|
looking at the phys2d demos, the gravity there is set as positive...
however when i set mine to positive my bodies go upwards~!
what is causing my positive gravity to move the bodies upwards?
hmm well i know i can just set my gravity as negative... but im still wondering why this happens
|
|
|
|
|
9
|
Game Development / Game Mechanics / Re: phys2d bug with restitution?
|
on: 2007-11-26 03:14:03
|
Creation of World 1 2 3 4 5
| World world; static final float GRAV = -0.98f; static final int NB_ITERATION = 2000;
world = new World(new net.phys2d.math.Vector2f(0.0f, GRAV), NB_ITERATION); |
Creation of Ball 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Body objbody; boolean _mv = true; boolean _rt = true; float _rd = 0.000001f; float _re = 0.4f;
public PhysObject(DynamicShape ds, float mass) { objbody = new Body(ds, mass); } public void setupObj(float xPos, float yPos, float rotation) { objbody.setMoveable(_mv); objbody.setRotatable(_rt); objbody.setRotDamping(_rd); objbody.setPosition(xPos, yPos); objbody.setRotation(rotation); objbody.setRestitution(_re); } public void setRestitution(float re) { objbody.setRestitution(re); }
PhysObject tempobj; playerWidth = 0.09f;
tempobj = new PhysObject(new Circle(playerWidth), 5.0f); tempobj.setupObj(-0.85f, 0.6f, 0.0f); tempobj.setRestitution(1.75f); list.add(tempobj); |
Creation of 2 Walls 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| float _rd = 0.000001f; float _re = 0.4f;
public PhysObject(DynamicShape ds, float mass) { objbody = new Body(ds, mass); } public void setupObj(float xPos, float yPos, float rotation, boolean moveable, boolean rotatable) { objbody.setMoveable(moveable); objbody.setRotatable(rotatable); objbody.setRotDamping(_rd); objbody.setPosition(xPos, yPos); objbody.setRotation(rotation); objbody.setRestitution(_re); }
PhysObject tempobj; net.phys2d.raw.shapes.Box b1 = new net.phys2d.raw.shapes.Box(0.8f, 0.03f);
tempobj = new PhysObject(b1, 5.0f); tempobj.setupObj(-0.55f, 0.2f, -0.2f, false, false); list.add(tempobj);
tempobj = new PhysObject(b1, 5.0f); tempobj.setupObj(0.415f, 0.2f, 0.2f, false, false); list.add(tempobj); |
the problem occurs when a ball drops into a funnel-shaped wall... and is trapped between both sides of the wall. causing the restitution to make the ball bounce erratically. i used 1.75f restitution for the ball and 0.4f restitution for the wall
|
|
|
|
|
12
|
Game Development / Game Mechanics / phys2d bug with restitution? *youtube link added*
|
on: 2007-11-22 06:37:08
|
|
ok so i managed to get the restitution thingy working at last (after looking at the demo source)
then i found out something...
if you drop a bouncy ball in between a couple of sloping walls the ball will jump away at an extreme velocity.
\o/ <<< figure of ball in between 2 sloping walls.
can anyone find a way to solve this problem?
|
|
|
|
|
18
|
Java Game APIs & Engines / Java 3D / Re: Weird rendering order
|
on: 2007-11-15 03:59:34
|
i think i figured out the problem. It's because i gave all my geometries a transparencyattributes. is there any way at all to depth buffer intersecting transparent objects properly? per-geometry doesn't work because my objects are intersecting... 
|
|
|
|
|
19
|
Java Game APIs & Engines / Java 3D / Re: Weird rendering order
|
on: 2007-11-14 09:35:09
|
 hi i am having a problem with depth buffer for objects that are supposed to be intersecting. can anyhow help figure out what is the problem? i already turned on the depthbuffer and it works fine. just the problem with intersecting objects like shown in the picture above. help me please it's giving me a headache 
|
|
|
|
|
25
|
Java Game APIs & Engines / Java 3D / Re: Picking not working right in Java3D
|
on: 2007-10-25 08:49:10
|
I wrote my own class for picking to avoid the problems of obscurity you are encountering. I do something like this to adjust for the projection distortion: 1 2 3 4 5 6 7 8 9 10 11
| c3D.getPixelLocationInImagePlate(pickXY.x, pickXY.y, p3d); c3D.getImagePlateToVworld(t3D); t3D.transform(p3d); v3d.sub(p3d, eyeIs); pickRay.set(eyeIs, v3d); PickInfo pi = sceneBranch.pickClosest(PickInfo.PICK_GEOMETRY, PickInfo.NODE, pickRay); |
I think this is as safe as it gets. and from here what do i do with the PickInfo? sorry if it's a noob question...
|
|
|
|
|
26
|
Game Development / Game Mechanics / Re: Phys2D usage questions:
|
on: 2007-10-22 10:33:14
|
|
hi guys can anyone help me with something?
how do i reset the physics? for example, an object in mid-fall will start to fall from rest once more.
coz i wan to make a reset button, but the thing is the physics calculation does not get reset! it's funny but not working as intended. i didn't see anything of use in the documentation so any help here would be greatly appreciated
edit: hmm i created a new instances of body and re-added them to the world... seems to work as intended now~
|
|
|
|
|
28
|
Game Development / Game Mechanics / Re: Phys2D usage questions:
|
on: 2007-10-19 10:17:35
|
|
im trying to use phys2D on a 3D rendered game... hope it works
edit: seems to work fine, but since im rendering the 3D images, i can't see the physics circles and boxes. makes it abit hard to sync the 3D stuffs and the "2D bounding box/circle"
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|