Game Development Community

Drawing line in normal directions from TSShapeInstance meshes

by J Helleman · in Torque 3D Professional · 03/30/2011 (3:01 am) · 1 replies

Hi guys,

as some of you might have noticed I am new to T3D and tring to do some prototyping for my study. I am trying to determine if certain meshes are fully visible within the camera. To do so I want to measure the normal direction towards the forward vector of the camera as a first step. I know this isn't going to be fast in realtime but as a demo purpose it will do.

I created the following code:
pastebin.com/j1fyeGen

The rendering happens in void Manager::_onPreRender( SceneGraph *sceneManager, const SceneState *state ).

The problem is that somehow the positioning against the scaling is not right and I can't figure out what is going wrong. The result is the following: img218.imageshack.us/i/offset.png/ and you can clearly see somehow it is displaced somewhat on the X and Y axis. Anyone got any idea's how to fix this?

Thanks a lot for your time,
Jan

#1
04/02/2011 (5:40 am)
Your code looks correct.
I think you have an offset in object space and you get a scaled offset in world space.This could be possible when your object is not centered the local space origin.
If your object is correct then try with uniform scale values (1,1,1), (2,2,2), (3,3,3).This will show if this is a matrix concatenation problem or not.