xexuxjy / bullet-xna

Automatically exported from code.google.com/p/bullet-xna
Other
21 stars 5 forks source link

Picking and box firing doesn't work in the Demos #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Build the demos from r32
2. Run the constraints demo
3. Box firing and picking doesn't work

Original issue reported on code.google.com by patricks...@gmail.com on 8 May 2011 at 10:04

GoogleCodeExporter commented 9 years ago
Box fire towards the edge of the screen doesn't fire straight, fires at a weird 
angle

Mouse picking either doesn't work at all or just paints the point2point 
constraint transform onto the object

Original comment by patricks...@gmail.com on 8 May 2011 at 10:07

GoogleCodeExporter commented 9 years ago
I can confirm both of those.

Original comment by andres.traks on 9 May 2011 at 9:30

GoogleCodeExporter commented 9 years ago
I'll double check the box firing as that was definitely working, though the 
aiming of the boxes was a bit rubbish. picking definitely missing though.

Original comment by xexu...@gmail.com on 9 May 2011 at 9:33

GoogleCodeExporter commented 9 years ago
The field of view in GetRayTo is wrong. FOV is defined as 40 degrees in the 
projection matrix, so instead of:
public Vector3 GetRayTo(int x, int y)
{
    float top = 1f;
    float bottom = -1f;
    float nearPlane = 1f;
    float tanFov = (top - bottom) * 0.5f / nearPlane;
    float fov = 2.0f * (float)Math.Atan(tanFov);
...

you just need:
public Vector3 GetRayTo(int x, int y)
{
    float fov = MathHelper.ToRadians(40.0f);
...

Original comment by andres.traks on 9 May 2011 at 10:02

GoogleCodeExporter commented 9 years ago
I applied that patch.

Original comment by andres.traks on 9 May 2011 at 10:11

GoogleCodeExporter commented 9 years ago
Picking Constraint has been fixed in demo.

Original comment by xexu...@gmail.com on 20 Jun 2012 at 9:15