Game Development Community

Different pose for different weapon

by CIMO · in General Discussion · 04/20/2006 (10:58 am) · 39 replies

Any resource or boy for help my? I have a different weapon and i would create a different pose on use...
Example:
I have a pistol and i use a pistol my play stay in pose of pistol....
I have a bazooka and i use this my player stay in pose of bazooka....
Thanks plase =D
Page«First 1 2 Next»
#21
04/28/2006 (5:47 am)
By putting it at the end this function will now become the new version of WeaponImage::onMount - the other one will not be called.
#22
04/28/2006 (5:49 am)
Cimo, don't put that code at the end of pistol.cs. You only have to have ONE copy of that function, just leave it inside weapon.cs making sure you replace the original one that's already there.
#23
04/28/2006 (5:55 am)
Oh TIM =) i see you exellent resource =) you very nice programmer....
Nice to meet you ...
I replace the code in weapon.cs and now? if replace the code only in weapon.cs my player use a "root_pistol" for all weapon....
#24
04/28/2006 (6:25 am)
That's because you have to specify an arm thread in each weapon file (pistol.cs & bazooka.cs).

So in pistol.cs you'd need something like this
datablock ShapeBaseImageData(pistolImage)
{
   // Basic Item properties
   shapeFile = "~/data/shapes/pistol/pistol.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 1;
   eyeOffset = "0.12 0.36 -0.29";
   [b]armThread = "root_pistol";[/b]
...
and in bazooka.cs
datablock ShapeBaseImageData(bazookalImage)
{
   // Basic Item properties
   shapeFile = "~/data/shapes/bazooka/bazooka.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 1;
   eyeOffset = "0.12 0.36 -0.29";
   [b]armThread = "root_bazooka";[/b]
...

Naturally you should disregard the contents of the above code with the exception of the bold sections. I only added the rest as a guide so you know which section of code to change.
#25
04/28/2006 (6:31 am)
Also, I think you've been mislead with what to put in the function WeaponImage::onMount(%this,%obj,%slot) section inside of weapon.cs.

It should be more like this
function WeaponImage::onMount(%this, %obj, %slot)
{
// Images assume a false ammo state on load. We need to
// set the state according to the current inventory.

   if (%obj.getInventory(%this.ammo)){
   %obj.setImageAmmo(%slot,true);

   [b]if (%this.armthread $= "")
   %obj.setArmThread(lookms);
   else
   %obj.setArmThread(%this.armThread);[/b]
}

That code will basically specify a default arm thread of 'lookms' if none is specified within your weapon image. So you may want to create a default armthread within your player model if you haven't done so already. If an arm thread is specified inside your weapon image (like I show you in my above post) it uses that instead.
#26
04/28/2006 (6:57 am)
Ok i test now =) i create a "root_pose" for my player and this is a generic pose...
Now pute the code and test...
THANKS =D
#27
05/01/2006 (6:35 am)
YES ALL OK!!! =) i use this and all ok =) very nice...I use a resource for Reload the weapon and i use a time for reload weapon and very GREAT =) =P
But i have a problem...If i use a rifle (continus fire..) i reload not problem...
If i use a pistol (single fire..) i have a problem....My player reload for all single fire....
I would cretate a animation for reload the clip...It's possible? CODE....
For the animation no problem ;) THANKS ALL really THANKS =)
#28
05/01/2006 (7:26 am)
Nice work Cimo! =)
#29
05/01/2006 (9:22 am)
Glad you got it working Cimo! As for your next question regarding reloading, well you've pretty much taxed me enough for the time being. Perhaps someone else can tackle this or even better, why don't you give it a go yourself Cimo? That's not meant to sound impolite, rather I feel it would be a good learning experience for you.
#30
05/02/2006 (4:15 am)
Ok Tim no problem....And THANKS for all.....
THANKS ar ALL....
I learn to change a clip with CODE....I use a resource "reload weapon" and all ok...
But i would create a CODE for reload animation of clip...
The hand take a clip end replace with new....I see a video in forum with a sniper reload image for shoot and clip...But i lost =P
any say?
#31
05/02/2006 (9:01 am)
I would have to say perhaps get a script firing with the Reload state of the weaponImage? What type of animation[blend or not?] and how it's structured[armThread or actionThread] is the tricky bit...

This script perhaps may need to have a serverCMD throw the player controlObject into this animation, another tricky bit...

...my 2 cents worth of ideas.
#32
05/02/2006 (8:27 pm)
This works also. In your individual weapon datablock, add armThread = nlook, and animate your player model to use that look animation. Make a look animation with something like a two-handed grip for the pistol, or rifle, or bazooka, or whatever you have in mind. You dont have to use the default look animation at all times.

datablock ItemData(Crossbow)
{
// Mission editor category
category = "Weapon";

// Hook into Item Weapon class hierarchy. The weapon namespace
// provides common weapon handling functions in addition to hooks
// into the inventory system.
className = "Weapon";

// Basic Item properties
shapeFile = "~/data/shapes/crossbow/weapon.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
emap = true;

// Dynamic properties defined by the scripts
pickUpName = "a crossbow";
image = CrossbowImage;
armThread = bowLook;
};
#33
05/02/2006 (8:28 pm)
Well i cant remember exactly where it goes, probably not there, but its something like that
#35
05/02/2006 (9:48 pm)
I think he's asking about how[scripting wise] to get the player to perform a reloading sequence with the weapon's reload State...armThread gives you the weapon holding posture. It has nothing to do with having the State of the weaponImage & getting the player to fire a sequence via script? Does it? Getting new look animations for merely holding a weapon is easy...
#36
05/02/2006 (9:54 pm)
Youl'd just have to setArmThread with your reload animation when in the reload state, and switch back when you're done. Make a scriptState for your reload state and set the animation there, and instead of having the weapon animation setting code onMount, have it in onActivate or some base level state, and go to that from the reload state. At least I know it'd works with playThread fine and I think armThread is a simplified version of that function for players...
#37
05/02/2006 (10:03 pm)
Hehe, I didn't read any of the recent posts, I just assumed these guys were having problems with the weapon arm thread script I posted.

As far as I know, weapon reloading with synced Player and Image animation isn't really possible in stock Torque without some serious script hackage. I got it a system working by using Paul Dana's arm thread play once code from the old Realm Wars project, and added manual image state changing to the shapeBase class (posted as a resource here.

Edit: The problem with using setArmThread for reload animations, IIRC, is that the animation is tied to the Player's pitch, therefore you're animation won't actualy play.
#38
05/03/2006 (3:57 am)
Nice image =) my player don't have a problem with mount the weapon or reload....But understand how create a code of reload a clip.....One hand take a weapon and one hand take a clip....
One question.....This resource "Setting an ImageState manualy"
I would learn step by step for understand.....
use for? ..... and this code
%shape.manualSetImageState(%slot, %imageState);
put in?
#39
05/03/2006 (7:22 am)
@Paul & Josh: I confusicated... Paul seems to say it's possible with a script calling[callback??], Josh is saying no, a 'real' C++ solution is needed?? I can't compile the binary, so a script-voluted solution is probably best for me...hehe.

@Paul: this armThread of the reloading sequence[hand holding weapon/hand moving 'ammo'], would it be a BlendType? or a plain vanilla .dsq. If it's a BlendType, what is the reference frame, the root position, as all blends should be[I think]? or the 'new' position the player would be in reference to[pistol weaponPose, rifle weaponPose, throwablePose...etc].

I ask so many questions because this is something I've been attempting to accomplish for quite some time and have never succeeded 100%... I see getting the player to react with the shapeBaseImage objects as important to an immersive environment, since these objects seem to be doing quite a bit of work, with the State system. I might be wrong, I'm trying to get the most interatction between player/objects as possible with my limited knowledge of coding.

Thanks for the info so far!
Page«First 1 2 Next»