Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Pages: [1] 2 3 4  All

Author Topic: have a 3d char walking and running  (Read 19788 times)

0 Members and 1 Guest are viewing this topic.

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
have a 3d char walking and running
« on: June 20, 2007, 12:17:34 PM »

Hello again. its been  a while but i managed to get 3d characters working in our game chess-worlds.
now i have the char walking.
i have an animation for running also

how can i declare the running animation and where do i have to do it ?
and how can i implement the running animation on left double click ?

sorry if this have been explained already. i only found something in the czech forum but cant manage to understand enough of it ...

greets stucki
« Last Edit: June 20, 2007, 04:03:57 PM by Stucki »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: have a 3d char walking and running
« Reply #1 on: June 20, 2007, 05:36:03 PM »

The code from the czech thread looks approximately like this:

Code: [Select]
method RunTo(x, y)
{
  this.WalkAnimName = "run";
  this.Velocity = 200;
  this.GoTo(x, y)
}


method GoTo(x, y)
{
  this.WalkAnimName = "walk";
  this.Velocity = 100;
  this.GoTo(x, y);
}

If you add this to your actor's script, you can then call actor.RunTo(100, 200); just like you'd call GoTo. The RunTo method changes the walking animation to an animation called "run", and it changes the movement velocity. The overriden GoTo method in turn changes the walking animation back to "walk" and restores the walking velocity.

So you've found a 3D modeller?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: have a 3d char walking and running
« Reply #2 on: June 20, 2007, 05:51:01 PM »

thanks now i begin to see !!
can i do the same with actor.GoToObject(x); ??

and yes i found a very good modeler ... but he is not doing the animation ... so i have to learn this myself ...
slowing down things a little bit ... but things are going on .. i just got a contract from a publisher ... now i have to see if i can get the game done in one year ...

greets stucki



Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: have a 3d char walking and running
« Reply #3 on: June 20, 2007, 06:50:20 PM »

hmmmm.
done everything but its not working. there is no difference between walking and running ... even the velocity is not changing ...
so i changed the x,y coordinates for the runto command to see if this works.
and this is okay if i double left click it walks to the new coordinates and if i left click it walks to the old ones.
there doesnt lie the problem ...

here is my actor script:

method RunTo(x, y)
{
  this.WalkAnimName = "run";
  this.Velocity = 3;
  this.GoTo(x, y);
}

method GoTo(x, y)
{
  this.WalkAnimName = "walk";
  this.Velocity = 1.5;
  this.GoTo(x, y);
}

method RunToObject(name)
{
  this.WalkAnimName = "run";
  this.Velocity = 3;
  this.GoToObject(name);
}

method GoToObject(name)
{
  this.WalkAnimName = "walk";
  this.Velocity = 1.5;
  this.GoToObject(name);
}

and here is the actor definition file:

ACTOR3DX
{
  NAME = "test_x"
  CAPTION = ""
  INTERACTIVE = TRUE
  ACTIVE = TRUE
  SCRIPT = "D:\Wintermute\Demo_1.0\data\actors\test_x\test_x.script"
  SCRIPT= "actors\molly\talk.script"
  SCRIPT= "actors\molly\footsteps.script"
 
  SCALE = 11000
 
  ;--- velocity
  VELOCITY =1.5
  ANGULAR_VELOCITY = 400.0

  ;--- external data
  MODEL = "d:\test.X"
  FONT = "fonts\nik.font"
  ;SHADOW_MODEL = "d:\test.X"
  SHADOW_TYPE = "stencil"
  LIGHT_POSITION { -10, -10, -10 }
  SHADOW_COLOR { 0, 0, 0, 208 }
  ;CURSOR = ...

ANIMATION
  {
    NAME="idle"
    LOOPING=TRUE
  }

ANIMATION
  {
    NAME="walk"
    LOOPING=TRUE
  }

ANIMATION
  {
    NAME="run"
    LOOPING=TRUE
  }
}

and here is the call from the object.script that triggers the actions:

on "LeftClick"
{
  actor.GoToObject(this);
}

on "LeftDoubleClick"
{
  actor.RunTo(400,400); // did this for seeing if it is working ... normal this would be actor.RunToObject(this);
}

any ideas ?!?
interesting is that the velocity of the walking isnt changing...

and yes there is a running animation defined in the x-file
 

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: have a 3d char walking and running
« Reply #4 on: June 20, 2007, 07:03:38 PM »

Ah, oops, my mistake. The original code looked a little bit different. It didn't use the normal GoTo() method for walking, but a custom method (such as WalkTo()). Because in the above code the RunTo method calls GoTo in the end, which in turn uses the overriden GoTo and switches the animation and velocity back.

So you'd have to use something like this:

Code: [Select]
method RunTo(x, y)
{
  this.WalkAnimName = "run";
  this.Velocity = 200;
  this.GoTo(x, y)
}


method WalkTo(x, y)
{
  this.WalkAnimName = "walk";
  this.Velocity = 100;
  this.GoTo(x, y);
}

and use WalkTo() instead of GoTo() in all your scripts..
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: have a 3d char walking and running
« Reply #5 on: June 20, 2007, 07:14:55 PM »

yeah thats it !!! many thanks for helping me once again ..

one last thing .. where can i change the running if i click somewhere irrelevant in the scene.
now my char is always walking if i click once or twice on no interactive object ..

have i to put it in the scene.ini ?
 

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: have a 3d char walking and running
« Reply #6 on: June 20, 2007, 07:16:20 PM »

It's handled in the scripts\scene.script, which is attached to every scene by default.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: have a 3d char walking and running
« Reply #7 on: June 20, 2007, 07:29:11 PM »

okay stupid me again ...
thanks for your time and patience !
 O0 ::rock O0

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: have a 3d char walking and running
« Reply #8 on: June 21, 2007, 09:16:52 AM »

everything works fine now except the stencil shadows.

if i turn on flat shadows everything works fine ... if i turn on stencil shadow i see no shadow ... even on the walkplane ...
i have created a geometry file but it doesnt change ...

any idea ??

Nihil

  • Supporter
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 528
  • Fear me! I'm evil!
    • View Profile
    • Order of Dagon
Re: have a 3d char walking and running
« Reply #9 on: June 21, 2007, 10:10:43 AM »

Did you enable the stencil-shadows in SceneEdit, too? (under 3d-options)

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: have a 3d char walking and running
« Reply #10 on: June 21, 2007, 10:15:28 AM »

yes in sceneedit as well as in the actor definition ...
if i switch in sceneedit to flat shadow everythings works fine, even if the actor definition says stencil ..

Nihil

  • Supporter
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 528
  • Fear me! I'm evil!
    • View Profile
    • Order of Dagon
Re: have a 3d char walking and running
« Reply #11 on: June 21, 2007, 10:51:50 AM »

Hmmm .... and the shadow-parts of the geometry appear in SceneEdit, too?

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: have a 3d char walking and running
« Reply #12 on: June 21, 2007, 11:05:49 AM »

i am not really sure what you mean ....

if i insert the char in scene edit i can see a shodow if i switch to flat shadows but i cant see a shadow if i turn to stencil shadows
i thought there would be no difference except the shadow appears on all hidden geometry that is shadow enabled by the .geometry file if i turn to stencil ...

Nihil

  • Supporter
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 528
  • Fear me! I'm evil!
    • View Profile
    • Order of Dagon
Re: have a 3d char walking and running
« Reply #13 on: June 21, 2007, 11:39:26 AM »

Note: I'm anything but an expert for stencil shadows ;-)

For using the shadows, you need the expanded hidden geometry, I think the shadow-catching objects must be named shadow_name (like walk_ and blk_ ). In SceneEdit you can see them by activating "Display Scene Geometry", and the "shadow-catchers" should appear in green.

At least that is how I understood it by reading the documentation and looking at the 3d-demo - I never really tried it myself as I don't use 3d characters atm.

Nihil

  • Supporter
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 528
  • Fear me! I'm evil!
    • View Profile
    • Order of Dagon
Re: have a 3d char walking and running
« Reply #14 on: June 21, 2007, 11:42:38 AM »

Oh, I overlooked the .geometry-stuff .... hm, then I'm out of ideas, sorry.
Pages: [1] 2 3 4  All
 

Page created in 0.043 seconds with 20 queries.