Game Development Community

Linking object positions in editor

by John Doppler Schiff · in Torque Game Engine · 07/29/2006 (2:32 pm) · 1 replies

WARNING: Potentially stupid question ahead.

I'm trying to construct a "bounce pad" style elevator: the player enters a pZone, gets a boot in the rear that propels him upwards, where another pZone punts him forwards and out of the bounce zone.

What I'd like to do is place a single object, the DTS bounce pad, and have the pZones created relative to its location. (The upwards pZone is always at the same point as the DTS, and the outwards pZone is always 4 units above.)

Sounds simple in theory, but my brain is squishier than usual today and I haven't been able to figure out how to get the position of the newly placed DTS. I'm working in the OnAdd method of the lift object, but I suspect that's the wrong place to be.

How can I dynamically add objects based on their position in the World Editor? Incorrect approach appears below...
function lift1::OnAdd(%db, %thisLift) 
{

	%thisLift.lifter = new PhysicalZone() {
		position = %thisLift.position;
		rotation = %thisLift.rotation;
		scale = "1 1 1";
		velocityMod = "0";
		gravityMod = "0";
		appliedForce = "0 0 10";
		polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
	};
}

Help me out on this one, and I'll owe you a solution for the brain-dead problem of your choice. =)