Player Vs Orc Animation in starter.fps
by Rojalee · in Torque Game Engine · 04/21/2006 (6:17 am) · 2 replies
Hi all.
Inserted a New model for player.
noticed that the orc from before always held his crossbow at the correct height,
so the animation for shooting must be with the crossbow.
On my new model, the crossbow is not being held correctly.
So I want to insert an animation for this.
I made the animation, now how do I get it to go off before the crossbow fires?
Inserted a New model for player.
noticed that the orc from before always held his crossbow at the correct height,
so the animation for shooting must be with the crossbow.
On my new model, the crossbow is not being held correctly.
So I want to insert an animation for this.
I made the animation, now how do I get it to go off before the crossbow fires?
About the author
#2
The first link you gave me, he references a player.cc function. I found the function, but mine isnt the same.
Also, what if I want to use a sword?
just have him swing it for damage?
04/21/2006 (8:00 am)
Only one small problemThe first link you gave me, he references a player.cc function. I found the function, but mine isnt the same.
void Player::renderMountedImage(SceneState* state, ShapeImageRenderImage* rimage)
{
AssertFatal(rimage->mSBase == this, "Error, wrong image");
GameConnection *con = GameConnection::getConnectionToServer();
bool renderMounts = true;
if(con && con->getControlObject() == this && con->isFirstPerson())
renderMounts = sRenderMyItems;
if (renderMounts == false)
return;
bool fogExemption = false;
if(con && con->getControlObject() == this && con->isFirstPerson() == true)
fogExemption = true;
F32 fogAmount = 0.0f;
if (fogExemption == false)
{
Point3F cameraOffset;
getRenderTransform().getColumn(3,&cameraOffset);
cameraOffset -= state->getCameraPosition();
F32 dist = cameraOffset.len();
fogAmount = state->getHazeAndFog(dist,cameraOffset.z);
}
// Mounted items
PROFILE_START(PlayerRenderMounted);
MountedImage& image = *getImageStruct(rimage->mIndex);
if (image.dataBlock && image.shapeInstance && DetailManager::selectCurrentDetail(image.shapeInstance)) {
MatrixF mat;
getRenderImageTransform(rimage->mIndex, &mat);
glPushMatrix();
if (rimage->mIndex == 0 && mWeaponBackFraction != 0.0 && getDamageState() == Enabled) {
MatrixF nmat;
MatrixF smat;
Parent::getRenderMuzzleTransform(0,&nmat);
Parent::getRenderImageTransform(0,&smat);
// See if we are pushed into a wall...
Point3F start, end;
smat.getColumn(3, &start);
nmat.getColumn(3, &end);
Point3F displace = (start - end) * mWeaponBackFraction;
glTranslatef(displace.x, displace.y, displace.z);
}
dglMultMatrix(&mat);
if (image.dataBlock->cloakable && mCloakLevel != 0.0)
image.shapeInstance->setAlphaAlways(0.04 + (1 - mCloakLevel) * 0.96);
else
image.shapeInstance->setAlphaAlways(1.0);
if (image.dataBlock->cloakable && mCloakLevel == 0.0 &&
(image.dataBlock->emap && gRenderEnvMaps) &&
state->getEnvironmentMap().getGLName() != 0) {
image.shapeInstance->setEnvironmentMap(state->getEnvironmentMap());
image.shapeInstance->setEnvironmentMapOn(true, 1.0);
} else {
image.shapeInstance->setEnvironmentMapOn(false, 1.0);
}
image.shapeInstance->setupFog(fogAmount,state->getFogColor());
image.shapeInstance->animate();
image.shapeInstance->render();
// easiest just to shut it off here. If we're cloaked on the next frame,
// we don't want envmaps...
image.shapeInstance->setEnvironmentMapOn(false, 1.0);
glPopMatrix();
}
PROFILE_END();Also, what if I want to use a sword?
just have him swing it for damage?
Torque Owner Tim Heldna
In your weaponimage::onMount function (the parent class one), add this:
if (%this.armthread $= "") %obj.setArmThread(look); else %obj.setArmThread(%this.armThread);Then in your weapon image datablock, add your armThread variable(the name of your animation in your player.cs file).Here's some links to get you started...
First/Third Person Different Weapon Models
Setting an ImageState Manually
Adding Multiple Recoiling Animations for a single Player Model
And here's a video of it in action...
AIAW Sniper Rifle Video (2.3mb)