### Switch weaponFireLight to muzzle point

Expanding and utilizing the engine via C++.

#### Switch weaponFireLight to muzzle point

Duion
Posts: 1099
Joined: Sun Feb 08, 2015 1:51 am

I noticed the weaponFireLight does not appear at the muzzle point of the weapon as it should be, but on the mount0 point, I found a resource that fixes this, but it is based on old code and no longer works: http://www.garagegames.com/community/re ... /view/8394
Someone has an idea how to do it now?

#### Re: Switch weaponFireLight to muzzle point

TorqueFan
Posts: 87
Joined: Thu Apr 30, 2015 5:35 am
I had a free moment and took a glance at it. I hadn't tested anything, but can lead you in the right direction.

The original resource you posted just changed a single function to use an overload. I found that same function, just shifted around to a new location.

° shapeBase.cpp - around Ln. 2625

Code: Select all

void ShapeBase::renderMountedImage( U32 imageSlot, TSRenderState &rstate, SceneRenderState *state ) { ... getRenderImageTransform(imageSlot, &mat, rstate.getSceneState()->isShadowPass()); ... } 
So you should be able to just change that line to:

Code: Select all

getRenderImageTransform(imageSlot,imageData->muzzleNode,&posMat); 
Basically the registerLights() function from the older resource isn't used anymore. Instead the call to renderMountedImage() is now in ShapeBase::prepBatchRender().

The only problem I'm seeing right away is 'imageData->muzzleNode' doesn't exist so you'll need to find a way to get ahold of the muzzleNode. I hadn't been using this node and all my models have custom setups, so it could be possible as well that you need to create and add such a node. All references to the 'muzzle' I can find at a quick look atm refer to the 'muzzlePoint' which isn't a node but a Point3F position.

Let me know how you get along with it and if necessary I might be able to take a closer look. Happy Torque-ing!

#### Re: Switch weaponFireLight to muzzle point

Duion
Posts: 1099
Joined: Sun Feb 08, 2015 1:51 am

The muzzle point is in the weapon models, it is created manually when modelling the weapon to define where the puzzle point is. It is a node in the model called "muzzlePoint"

#### Who is online

Users browsing this forum: NeonTiger and 2 guests