Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Animated Drawbridge Issues #456711
12/06/15 09:15
12/06/15 09:15
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
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:

Code:
...

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?

Re: Animated Drawbridge Issues [Re: Ruben] #456712
12/06/15 10:00
12/06/15 10:00
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
try updating the hull on the animation frame...


Compulsive compiler
Re: Animated Drawbridge Issues [Re: Ruben] #456713
12/06/15 10:17
12/06/15 10:17
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
For the second issue, try setting USE_POLYGON in the c_move that your player uses, instead of the polygon flag of the bridge.

And, take a look just in case, in the section on collisions in the manual (type collisions in the search box)...

As for the animation, I can only think of one thing. It could be some sort of an issue from the WED>MED>Engine process. I have no idea how WED exports MLD files (never used it before), but try making a quick mockup of the bridge and chain (don't model the whole chain, just a box or something) and see if you can get it working in the engine with animation. Another thing to try is to export all frames from your model in another file format and import them again in MED and save as MDL. This should remove any issues that could have been exported from WED to MDL...Preferably, if you have 3DSMax, import the model there and see if there is movement... In there you could also use bones, if that could do the trick...

Hope this helps...


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Animated Drawbridge Issues [Re: EpsiloN] #456719
12/06/15 20:35
12/06/15 20:35
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Great! Thank you WjBender. I got the collision to work. I used c_updatehull() after the drawbridge animation is over, and the player can now walk on the drawbridge just fine.

I am still having issues with the chain link animation.

I have a bone on one side of the bridge that rotates it downward, but I do not have any bones linked to or moving the chain links. I manually moved the chain links to be where they needed to be in each animation frame without bones, individually if needed to go on a set path around the elevated horizontal cylinder, while remaining attached to the drawbridge.

The way I exported the WED drawbridge to MED was: File / Export / Export to MDL7 File

This exported the WED drawbridge to become a .mdl file.

Last edited by Ruben; 12/06/15 20:37.
Re: Animated Drawbridge Issues [Re: Ruben] #456720
12/06/15 21:02
12/06/15 21:02
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
I think you cant mix bones and vertex animation for one entity...


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Animated Drawbridge Issues [Re: EpsiloN] #456721
12/07/15 00:46
12/07/15 00:46
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Would I have to attach bones along the chain, and move the bones rather than the chain link objects themselves?

The chain links are all separate objects. The chain is not one object, but is made up of many entities, about 22 or so chain links linked together to form one chain.

Re: Animated Drawbridge Issues [Re: Ruben] #456726
12/07/15 07:39
12/07/15 07:39
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
It doesn't matter that they're not one object (as long as they're one model file), you can still affect them with a bone.

However, I think it would be easier to just drop the bones and use entirely vertex animation. Animating a chain with bones will require a bone for every link if you want it to look like its bending around a wheel, but animating the bridge itself with vertex animation is a matter of simply rotating the bridge on two key frames laugh
You already have a vertex animation for the chain, just delete the bone and rotate the bridge vertices...


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Animated Drawbridge Issues [Re: EpsiloN] #456727
12/07/15 08:16
12/07/15 08:16
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
from the manual , under med-how to-create bones animation ,bottom of page :

Please note:
Although vertex and bones animation can be combined within the same frame, this is not supported by the engine. Thus a model can have either bones or vertex animation, but not both. If a model has both bones and vertex frames, the vertex frames must come first (and are ignored by the engine).

...

you also have this option :
in med , object menu - change animation - convert to vertex animation.


Compulsive compiler
Re: Animated Drawbridge Issues [Re: Wjbender] #456775
12/09/15 05:27
12/09/15 05:27
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Thank you EpsiloN and Wjbender. I finally got the drawbridge to work. I ended up ditching the bone animation, and using only vertex animation on it. Now it runs perfectly! :-D

I learned from this the two different types of animation, vertex and bone. I also realize that there may be different purposes for using either of them. Thank you.


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1