Placing Unit above the terrain
by Hosam Mekawey · in RTS Starter Kit · 01/07/2006 (1:17 pm) · 5 replies
I am a beginner in using RTS Starter kit,
when i was trying to place a unit above the terrain (flying) for a purpose in my mind, it is forced to be placed on the terrain surface (z axis value is modified to be that of the terrain) by the engine.
is there any way to get arround this ??
(my purpose is to make a flying rtsunit)
please if any one has an idea, don't hesitate to share.
thanks.
when i was trying to place a unit above the terrain (flying) for a purpose in my mind, it is forced to be placed on the terrain surface (z axis value is modified to be that of the terrain) by the engine.
is there any way to get arround this ??
(my purpose is to make a flying rtsunit)
please if any one has an idea, don't hesitate to share.
thanks.
#2
That's really cool. I hadn't thought of having flying units, but hey, why not?
How does it work if you move the camera "through" a flying unit? Do you get a really funky interior view of the object, or something else?
01/07/2006 (6:36 pm)
*chuckle*That's really cool. I hadn't thought of having flying units, but hey, why not?
How does it work if you move the camera "through" a flying unit? Do you get a really funky interior view of the object, or something else?
#3
but i don't think that this will be a problem since the RTSunit in an RTS game will be relatively small so the chance that the camera will stop inside the unit will be rare.(if you allow it to move in the first place...).
01/08/2006 (4:16 am)
Yes you will see the interior view of the object, since there is no restriction for that.but i don't think that this will be a problem since the RTSunit in an RTS game will be relatively small so the chance that the camera will stop inside the unit will be rare.(if you allow it to move in the first place...).
#4
How do selections work? Do you click on the unit itself (the air above the ground), or the ground under the unit?
I appreciate your answers, as it'll save me time to know what to expect later (and anyone else who finds this thread).
01/08/2006 (5:45 am)
That's a very good point.How do selections work? Do you click on the unit itself (the air above the ground), or the ground under the unit?
I appreciate your answers, as it'll save me time to know what to expect later (and anyone else who finds this thread).
#5
01/08/2006 (9:12 am)
I added your code suggestion. Something I noticed is that he green circles around the selected units no longer appears.
Torque Owner Hosam Mekawey
in the RTSUnit.cc file
function processTick(const Move *move)
change the adjustment of the z position of the unit to allow it to be > terrain height if wanted.
old code:
if (mFabs(location.z - height) > 0.01)
{
location.z = height;
setMaskBits(MoveMask);
}
}
PROFILE_END();
new code:
if (location.z< height && mFabs(location.z - height) > 0.01)
{
location.z = height;
setMaskBits(MoveMask);
}
}
PROFILE_END();
now we allow RTSUnits to be above or On the terrain but not bellow..