Switch weaponFireLight to muzzle point

Expanding and utilizing the engine via C++.
3 posts Page 1 of 1
Duion
Posts: 1102
Joined: Sun Feb 08, 2015 1:51 am
 
  by Duion » Mon Mar 14, 2016 12:00 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?
TorqueFan
Posts: 87
Joined: Thu Apr 30, 2015 5:35 am
by TorqueFan » Wed Mar 16, 2016 3:44 pm
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!
Duion
Posts: 1102
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Wed Mar 16, 2016 5:42 pm
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"
3 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests