Jump to content

Replace TP and FP player models with only scripting?


Recommended Posts

Posted

I've noticed that there is a lot of hardcoded stuff in player.cpp. Is it possible to create a completely new TP and FP player models with only script changes?

Posted

Not images, the models. They are referenced in the player datablock, OK. I can just switch that, but the code inside the player class expects some bones and tags to exist, that's what i mean by hardcoded.

Posted
Not images, the models.

 

A weapon image is the model. As an example, open up art/datablocks/weapons/Ryder.cs:

 

datablock ShapeBaseImageData(RyderWeaponImage)
{
  // Basic Item properties
  shapeFile = "art/shapes/weapons/Ryder/TP_Ryder.DAE";
  shapeFileFP = "art/shapes/weapons/Ryder/FP_Ryder.DAE";
  emap = true;

  ...
}

 

Here the 'RyderWeaponImage' datablock uses the 'shapeFile' field to designate where the new weapon model is located. Is this what you are after, just trying to import a new model for a weapon? If you were to change that above to point to another .DAE file, when the Soldier tried to equip the Ryder weapon it would instead equip the new weapon model. There are optional nodes that can be added to the model's art for things like the muzzlepoint, ejectpoint, etc. but none of that is required and nothing in the player code will prevent any shape from being used as a weapon.


Otherwise, if you are needing to implement an entirely new weapon class that has a different functionality you would need to create a new weapon class in source (probably based off of ShapeBaseImageData).

Posted

The Player class expects a model that uses the 3DS MAX Biped naming convention more or less. You can rig your player models (or other models) in any way you like, but certain bones are expected to have particular names.


Once your model is rigged just export it to COLLADA and then get it imported. Someone posted a basic walkthrough on that somewhere on the old GG forums if I recall....


So, I guess actually the answer is "NO," you cannot create new models purely in script - you have to use a modelling application to make and export them. But switching between models is done in script.

Posted

It does not matter what your model is like, you just need to follow some conventions for LOD levels if you want to use them and the names for the nodes like eye, mount etc.

Posted

Which particular bones are giving you trouble? I thought a lot of those hardcoded bone names were actually unused currently. AFAIR all the spine nodes are unused. Things like eye and cam are still used, but they make sense!

Posted
The Player class expects a model that uses the 3DS MAX Biped naming convention more or less. You can rig your player models (or other models) in any way you like, but certain bones are expected to have particular names.


Once your model is rigged just export it to COLLADA and then get it imported. Someone posted a basic walkthrough on that somewhere on the old GG forums if I recall....


So, I guess actually the answer is "NO," you cannot create new models purely in script - you have to use a modelling application to make and export them. But switching between models is done in script.

 

This is what i'm talking about. What are the required bone names?

Posted
This is what i'm talking about. What are the required bone names?

They're in the source....

https://github.com/RichardRanft/Torque3D/blob/development/Engine/source/T3D/player.cpp#L514

Just take a quick look - I figured you had already found this or you wouldn't have brought it up earlier....


Also - should name anim sequences like these to get them to automatically work when moving:

https://github.com/RichardRanft/Torque3D/blob/development/Engine/source/T3D/player.cpp#L141


I do homework for $25 a page, too.

Posted
This is what i'm talking about. What are the required bone names?

 

Gosh, my bad man, totally misread your OP and thought you were interested in weapons... The bones go like this:

 

-Bip01
  -Bip01 Pelvis
     -Bip01 Spine
        -Bip01 Spine1
           -Bip01 Spine2
              -Bip01 Neck
                 -Bip01 Head
                     Bip01 HeadNub
                 -Bip01 L Clavicle
                    -Bip01 L UpperArm
                       -Bip01 L Forearm
                          -Bip01 L Hand
                 -Bip01 R Clavicle
                    -Bip01 R UpperArm
                       -Bip01 R Forearm
                          -Bip01 R Hand
        -Bip01 L Thigh
           -Bip01 L Calf
              -Bip01 L Foot
                 -Bip01 L Toe0
                    -Bip01 L ToeNub
        -Bip01 R Thigh
           -Bip01 R Calf
              -Bip01 R Foot
                 -Bip01 R Toe0
                    -Bip01 R ToeNub

 

That's pretty much the basic layout, I didn't include finger bones which are unimportant for the example anyways. Some of the nodes are rarely used but here's a list of those as well in case:


AltEye

-GunCam


Eye

-Cam

-FollowCam


mount0


I've heard of an 'ear' node as well but haven't ever seen it in any of the source art.


The important bones deal with the player code resolving the spine - in player.cpp:

 

      // Resolve spine
     spineNode[0] = mShape->findNode("Bip01 Pelvis");
     spineNode[1] = mShape->findNode("Bip01 Spine");
     spineNode[2] = mShape->findNode("Bip01 Spine1");
     spineNode[3] = mShape->findNode("Bip01 Spine2");
     spineNode[4] = mShape->findNode("Bip01 Neck");
     spineNode[5] = mShape->findNode("Bip01 Head");

 

These bones are important for the player's 'look' animation, which you can define in the player model's .cs file. Hope this is helpful.

  • 2 years later...
Posted

@TorqueFan I was interested in changing the weapon, I have a pistol with silencer but I can't just put it in. It wont show up properly in first person view. How would I just change the weapon?

Posted

Hey Hodo33, if your talking about keeping the FPS arms and replacing the weapon, the only way I found is by using 3DStudio Max 2010-2011 to import the Lurker or Ryder and replace the model but keep the animations. The animations for the arms are contained within the weapons in default Torque3D. It is unfortunate really because without 3Dmax it seems impossible. Probably the easiest way to learn more is to download the source for Ubergame by Duion and look at how he does his paintball gun. Another way, if you are decent at animation and modeling, you could create your own arms and animations. Sorry I'm not much help here but I have no way of using 3dMax anymore and therefore can not make custom weapons with the existing arms.

Posted

The paintball player is a new model I made from scratch, it does not have FP hands or weapons or animations, it's all in the TP model. I did not release the source for him yet, since he is not complete, but I can send the file if someone is interested.

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...