I created a drawbridge in WED, and imported it into an MED file, which made it a .mdl model file.
I created an animation for the drawbridge with about 21 different frames for each chainlink, of the drawbridge lowering, with the chains that are lowering the bridge going around a spinning horizontal cylinder object above and behind the bridge itself.
I created a switch lever in WED, and also imported it into MED making it a .mdl model file. In the game, when the player clicks the switch, this makes the switch go down and up, which triggers the drawbridge getting lowered.
One bad thing about the drawbridge, is that the chain links are not following the bridge downward, like the animation shows in its MED file. The bridge is lowering, but the chain links are not following or moving. In the MED file on the upper right screen shot, the chain links are moving around the spinning horizontal cylinder object, and remain connected to bridge as it lowers.
Another thing is that when the player tries to walk on the bridge, the player walks through the bridge like it is not there, with what appears no collision occurring.
Here is my code making this all happen:
...
ENTITY* drawBrdg;
...
function bridge_event()
{
set(drawBrdg, POLYGON); // I thought this would allow
// player to walk on drawbridge,
// but it is not working.
drawBrdg.ANIMATION = 0;
while(1)
{
ent_animate(drawBrdg,"bridgeDown",drawBrdg.ANIMATION,0);
drawBrdg.ANIMATION += 1*time_step;
if (drawBrdg.ANIMATION >= 100)
{
return;
}
wait(1);
}
}
function bridgeSwitch_event()
{
if (event_type == EVENT_CLICK)
{
my.ANIMATION = 0;
while(1)
{
ent_animate(me,"moveSwitch",my.ANIMATION,0);
my.ANIMATION += 10*time_step;
if (my.ANIMATION >= 100)
{
bridge_event(); // moving switch lowers drawbridge
return;
}
wait(1);
}
}
}
...
action bridgeSwitch_actn() // Assigned to switch that lowers
// drawbridge.
{
my.emask |= ENABLE_CLICK;
my.event = bridgeSwitch_event;
}
...
...so if the player brings up the mouse cursor and clicks the switch, the switch moves down and up, and the drawbridge lowers, but without the chain links animated in such a way that it looks like the chain links are lowering the bridge, even though the drawbridge.mdl file shows in the animation on the top right screen that the chain links are following the bridge.
When I run Engine Preview in the drawbridge.mdl MED file, I am seeing the same thing on the engine preview as I see in the actual game; the chain links not moving and not following the draw bridge, even though they appear to do so in the MED file without Engine Preview, on the upper right screen.
Also, the drawbridge does not appear to be offering collision with the player, as the player walks through the drawbridge as if it is not there.
Anyone have a clue if I am doing something wrong to make this happen?