• Create Account

Ed Welch

Member Since 08 Jun 2009
Offline Last Active Nov 05 2014 01:52 PM

In Topic: Panning camera so object is at edge of screen

17 September 2014 - 05:41 AM

I sort of got it working. This is the code that I used:

```	m_plane[RIGHT].Normalize();

Vector3D up(0, 0, 1.0f);
Vector3D xAxis = up.crossProduct(m_dir);
xAxis.normalize();

float distToPlane = m_plane[RIGHT].GetDistance(pos);
xDist = distToPlane / m_plane[RIGHT].DotProduct(xAxis);

```

It almost positions the object correctly, but it's slightly off. I can't figure out where the error is.

Anyways, thanks for the answer ;)

In Topic: Panning camera so object is at edge of screen

16 September 2014 - 04:48 PM

Think in terms of frustrum planes, not view rays.

You could try something like this, again using the right frustrum plane for example:

1. get the plane equation

2. cast ray R along x-axis to find object-plane distance

3. move camera along x-axis so that distance is 0

depending on the object or which bounding geometry you use you should

sample the distance at every vertex and use the minimum or something like that.

im not really sure what you are trying to do. after the camera translation the object

should still be outside the camera view, right?

I'm trying to pan the camera the minimum amount so the object moves just into the view frustrum. The object position p is in the center of the object, so moving it into the edge of the frustrum would make it half visible (which is good enough)

In Topic: Panning camera so object is at edge of screen

16 September 2014 - 02:44 PM

Yeah, but what about the maths?
So far, I have worked out the following:
camPos + camDir*t + tan(fov)*t = p
where t = distance to object and p = postion of object
now t = sqrt((camPos.x-p.x)^2 + (camPos.y-p.y)^2 + (camPos.z-p.z)^2)
but I have no idea how I can solve that because I only have one equation and two variables

In Topic: COLLADA vs FBX... Are They Worthwhile for Generic Model Formats?

03 September 2014 - 09:07 AM

These are just some of the reasons we created the Open Game Engine Exchange format (OpenGEX):
http://opengex.org/

Interesting. Can you save the file as binary? That would be an important feature.
For an interchange format it's not really that important -- games don't use Collada/FBX/ogex files directly, so they don't have to be optimized for loading. You should always convert from your interchange formats to a binary format that's optimal for your specific engine.

It might be interesting for OpenGEX to additionally define a game-ready binary format that's useful for 90% of devs though

When I started using Collada I was worried about simple 1MB models being stored as 60MB of text/xml... But it seems to work fine as all the decent repository systems compress text files before storage/sync anyway.

It slows down the art pipeline. At critical parts of the project your going to be exporting huge scene into your world editor, maybe 100's of times a day.

In Topic: COLLADA vs FBX... Are They Worthwhile for Generic Model Formats?

02 September 2014 - 05:20 PM

These are just some of the reasons we created the Open Game Engine Exchange format (OpenGEX):

http://opengex.org/

Interesting. Can you save the file as binary? That would be an important feature.

PARTNERS