Game Development Community

Parameters for PhysicalZone

by Rawles "Numba" Roberts III · in Torque Game Engine · 03/09/2006 (8:55 pm) · 2 replies

I will begin by summing up what I know:

That PhysicalZone takes 12 values

1 for velocityMod
1 for gravityMod
3 for appliedForce
6? for polyhedron

Sum = 11 values

1) What is the 12th value? Are there 7 values for polyhedron? IF not, then what is the 12th value, and what does it do?

2) While I understand the 3 values for appliedForce (force on x axis, force on y axis, force on z axis), I do not understand what the 6(?) values for polyhedron do. Do they specify corner position (x y z) and size (x y z), like missionArea, only in 3 dimensions? If not, then what specifically do they do?

3) What is the 12th variable used for?

Reason:
I am trying to make a space game with the ability to 'roam' aroudn the station later, and have browsed much of the resources for various ideas on this subject. One of which was a relatively simple inclusion of a PhysicalZone, with a 0 gravitymod (there was more in the discussion, but that is not what is causing confusion).

I have searched the documentation, the resources, and these forums for an answer. I even tried to figure it out from the source (I'm an SDK owner), and so far have come up empty. So if someone could explain this, I would be very grateful. I would prefer (for the time being) this method of 'nullifying' the gravity to modifying the code to premanently remove gravity.

Thank you in advance.

#1
03/13/2006 (8:36 pm)
The polyhedron field is broken down like this:

Point3F origin;
   Point3F vecs[3];

   U32 numArgs = dSscanf(argv[0], "%g %g %g %g %g %g %g %g %g %g %g %g",
                         &origin.x, &origin.y, &origin.z,
                         &vecs[0].x, &vecs[0].y, &vecs[0].z,
                         &vecs[1].x, &vecs[1].y, &vecs[1].z,
                         &vecs[2].x, &vecs[2].y, &vecs[2].z);

It then uses the three vectors to build a box starting at the origin and having its corners at the end of the three vectors.

So take a look at the default polyhedron value:
0 0 0 1 0 0 0 -1 0 0 0 1

The first three numbers are the origin of where the box will be (in local space).
The second three numbers are a vector straight down the x-axis.
The third three numbers are a vector straight down the y-axis.
The fourth three numbers are a vector straight down the z-axis.

This is going to build a box that is 1 unit x 1 unit x 1 unit and centered at (0.5, -0.5, 0.5) in local space.

If you wanted a bigger box then you would just increase the 1's. So 0 0 0 10 0 0 0 -5 0 0 0 1
would produce a box that is 10 units x 5 units x 1 unit.

Now why didn't whoever code this just make it three parameters: length width height? Because with this system you can actually produce non-square boxes.

Consider 0 0 0 10 10 0 0 -1 0 0 0 1. Notice that the first vector is actually 10 10 0 instead of 10 0 0. This is going to produce a slanted vector and thus a slanted box. You are always going to want to create a 6-sided box (otherwise you run into ugly collision issues) but you can get some pretty skewed shapes by manipulating the three vectors.

Hopefully this covers everything you need to know about the polyhedron field in the PhysicalZone and Triggers.
#2
03/13/2006 (8:49 pm)
I've been wondering about that polyhedron business for ages !
well, months. but it seems like ages.
thanks matt.

got it captured in TDN ?