Game Development Community

Players dynamic fields in C

by Dracola · in Torque Game Engine · 12/18/2005 (10:52 am) · 3 replies

Maybe I should start this off by saying I'm new to C++ so this is probably a noob question.

how do I get a players dynamic fields in C++ I want it to look something like this

...mounting script

%obj.mountoffset = "0 40 30";


in C++

void Player::setRenderPosition(const Point3F& pos, const Point3F& rot, F32 dt)
{
MatrixF mat;
if (isMounted()) {
// Use transform from mounted object
MatrixF nmat,zrot;
mMount.object->getRenderMountTransform(mMount.node+>>>getFieldValue("mountoffset")<<<,&nmat);
zrot.set(EulerF(0, 0, rot.z));
mat.mul(nmat,zrot);
}

I pointed to the part that doesn't work how would I get the dynamic field from the code

#1
12/18/2005 (12:28 pm)
No takers?
#2
12/18/2005 (3:36 pm)
Try waiting longer than an hour for a response. :)

You have to convert the field into the proper type. There's a lot of examples all through the engine on how to do this. One possibility is to register the field with Con::addField in initPersistFields as a TypePoint3F.
#3
12/19/2005 (1:56 pm)
Okay thanks I'll check it out.