3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: Glock (pistol) with animations [update]  (Read 1853 times)

« on: December 22, 2011, 12:48:22 AM »
[update] Here is a improved Glock model with sounds.

New video - http://www.youtube.com/watch?v=vS7IuxiB5Fs

EDIT: For the last time its
NOT from CS
 its a model from Gamebanana.com it has
NO
 copy-right
« Last Edit: February 25, 2012, 07:57:20 AM by Har88 »
Yeah.. I'm back, momentarily... been busy with the minecraft business over at http://www.harsworld.com/
« Reply #1 on: December 24, 2011, 10:37:46 AM »
The gun is a 9mm pistol from Garry's Mod or HL2DM.
« Reply #2 on: December 24, 2011, 02:54:28 PM »
its not, the model is from gamebanana.com
it has no copy-right on it
Yeah.. I'm back, momentarily... been busy with the minecraft business over at http://www.harsworld.com/

secondry2

« Reply #3 on: January 15, 2012, 06:59:03 PM »
hey Har88,
how do u do the pistol animation, i know how to do automatic gun anims, but how do u do single shot?
« Reply #4 on: February 02, 2012, 06:51:44 AM »
Well instead of having a constant shooting animation just make the animation do one shot and then in 3d rad u gotta make it so when u hold down the mouse button it only shoots once every time u click (sorry i cant explain very well my computers been down for a while and i havnt used 3d rad in a long time im useing a school comp to reply lol....) but i think u just stop the loop animation option in rad for the skin mesh of your weapon and dont loop the projectile then it should do one bullet every click i think. like i said i cant really give u a straight answer atm im sure one of the globl mods or guru could help u.
Yeah.. I'm back, momentarily... been busy with the minecraft business over at http://www.harsworld.com/

jestermon

« Reply #5 on: February 02, 2012, 07:48:47 AM »
Animation duration. You can set the animation to play for a certain time and then stop. Set this value to zero to play forever. This feature can be used, for example, to play an animation only once, by setting the proper time, depending on animation speed. Time value is in seconds and decimal values, like 3.731 (3 seconds and 731 thousands-of-second) are valid.

Restart the animation with an event or a script
« Last Edit: February 02, 2012, 07:51:10 AM by jestermon »
« Reply #6 on: February 02, 2012, 07:59:23 AM »
But Jestermon, what if a idle animation is used?
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0

jestermon

« Reply #7 on: February 02, 2012, 08:10:19 AM »
But Jestermon, what if a idle animation is used?

Yes, you have a good point, since the character will have more than one animation, and you don't want to stop the "idle".

Edit: To control any animation set with script, here is the recipe.

An animation set can have any number of frames, but to the engine, the first frame in the animation time is always 0, and the last time in the animation is always 1.

Using a timer. you can set the "Animation Time" eg. OUT_22 to the decimal value of the time you need between 0 and 1, and in that way you can set which animation frame must be used in the game frame.

So to play a particular animation only once, you can have a function to step through the animation frames as needed. toggle the function on/off with some boolean.variable.

A tricky task, but not too difficult.

Code: [Select]
//By using the animation time, (which is really the current frame)
//One can control the animation by selecting the correct frame
//and simulating the animation with script

float numFrames = 56;
float currentFrame = 0;
int THING = OBJ_0;
int timer = 0;
int delay = 20;
string S;
bool ANIMATE = false;

///-------------------------------------------------------------------------
void SetFrame()
{
   if(!ANIMATE){
      OUT_0 = 1/numFrames*currentFrame*2.3;
      OUT_1 = 0;
   }else{
      OUT_1 = 0.1;
   }
}

///-------------------------------------------------------------------------
void Main()
{

   if(timer < delay) timer++;

   if(timer == delay){
      if (iKeyDown(iKeyCode("DIK_UP"))){
         ANIMATE = !ANIMATE;
         timer = 0;
      }
   }
   if (iKeyDown(iKeyCode("DIK_LEFT"))){
      currentFrame-=0.1;
      if(currentFrame < 0) currentFrame = numFrames-1;
   }
   if (iKeyDown(iKeyCode("DIK_RIGHT"))){
      currentFrame+=0.1;
      if(currentFrame >numFrames-1) currentFrame = 0;
   }

   SetFrame();
   iObjectTextSet(OBJ_22,S="Frame #"+IN_1);
}
« Last Edit: February 02, 2012, 10:09:05 AM by jestermon »
Pages: [1]