Cam node drops to ground
by Nmuta Jones · in Torque Game Engine · 02/25/2010 (10:46 pm) · 15 replies
In my game, you can switch players to become a giant.
When this happens, the cam node needs to be much higher and further back to see your full body.
My giant has a cam node, and its exporting correctly according to my .dmp file.
The came DOES move back when I push it back in 3ds max, but it still drops to the ground. I need the camera high, at least above the waist of the giant.
Any suggestions? Adjusting the pivot point of the bounds box wont' work for me either, because if I set that pivot point high, then part of the giant becomes buried in the ground. I need to do it with the cam node.
please advise.
by the way, I DID uncheck "collapse transforms" on the cam node. And its linked to Bip01 head. Shows up in show tool pro as being one of the exported nodes.
When this happens, the cam node needs to be much higher and further back to see your full body.
My giant has a cam node, and its exporting correctly according to my .dmp file.
The came DOES move back when I push it back in 3ds max, but it still drops to the ground. I need the camera high, at least above the waist of the giant.
Any suggestions? Adjusting the pivot point of the bounds box wont' work for me either, because if I set that pivot point high, then part of the giant becomes buried in the ground. I need to do it with the cam node.
please advise.
by the way, I DID uncheck "collapse transforms" on the cam node. And its linked to Bip01 head. Shows up in show tool pro as being one of the exported nodes.
About the author
Lead Developer for MediaBreeze Multimedia
#2
Static height settings on the cam? hm. I don't know. I am using AFX 2.0
Yes, I do have an eye node and its showing up in ShowTool pro so I know that the eye node is in there.
02/26/2010 (6:00 am)
Yeah, the cameraMaxDistance variable only helps me to scoot the camera BACK further. I need the camera UP. Back works fine. Static height settings on the cam? hm. I don't know. I am using AFX 2.0
Yes, I do have an eye node and its showing up in ShowTool pro so I know that the eye node is in there.
#3
02/26/2010 (8:21 am)
how about the FOV? If the Giant is much larger than the regular player, the FOV may need to be smaller. I assume your using setControlObject to switch from playerReg to playerGiant, yes? Some have figured a way to change the height of the cam thru engine code. Didn't know if you were one of them or not. You're not trying to dynamically move a node in-game without an animation, right? Is the transformation from playerReg to playerGiant a morph or are they two different characters that can be switched to and from? Try starting as playerGiant and switch to playerReg and see if the results are the same.
#4
They are two distinct characters.
I switch characters by deleting the old one, getting his transform, spawning a new character, and setting the control object to the new player.
I will try going from big to small now.
02/26/2010 (8:25 am)
Never tried the FOV but I generally don't mess with that because of the distortion that can occur.They are two distinct characters.
I switch characters by deleting the old one, getting his transform, spawning a new character, and setting the control object to the new player.
I will try going from big to small now.
#5
Small snaps back into place perfectly for the small character.
So the issue is still not the distance for the big cam , but the HEIGHT of the camera for the big character.
02/26/2010 (8:36 am)
Ok, I just trying going from "big" to "small"..... same problem. Big is the same it was in my first try. Small snaps back into place perfectly for the small character.
So the issue is still not the distance for the big cam , but the HEIGHT of the camera for the big character.
#6
02/26/2010 (1:12 pm)
I know that what I want to do should be possible. Anyone else have any ideas? I just need the cam higher when I switch to the giant.
#7
If this transaction takes to long, try unbinding and then rebinding the moveMap so the client can't go flyin' around with the cam.
Edit:What your trying to do is very possible and shouldn't be causing as much trouble as it is causing.
02/26/2010 (1:42 pm)
when you delete playerSmall, try setting the cam as the control object. At the end of spawning playerBig, set the control object to playerBigfunction switchCharacters(%client, %playerObj)//playerBig or playerSmall
{
%trans = %playerObj.getTransform();
%client.setControlObject(RegularCamName);
if(%playerObj.getName() $= "playerBigName")
{
playerSmallName.delete();
playerBig.spawn();//...or however your spawning
playerBig.setTransform(%trans);//unless you set transform in spawn
%client.setControlObject(playerBig);
}
else
{
playerBigName.delete();
playerSmall.spawn();//...or however your spawning
playerSmall.setTransform(%trans);//unless you set transform in spawn
%client.setControlObject(playerSmall);
}
}If this transaction takes to long, try unbinding and then rebinding the moveMap so the client can't go flyin' around with the cam.
Edit:What your trying to do is very possible and shouldn't be causing as much trouble as it is causing.
#8
and then setting the bounding box in the giant's datablock to an obscene amount, like 100 100 100
But walking and getting around is difficult.....the bounding box seems to be getting in the way.
02/26/2010 (3:39 pm)
I am having some fair but not good success doing this: %trans = %original_player.getEyeTransform();
%x = getmyx(%trans);
%y = getmyy(%trans);
%z = getmyz(%trans);
%rot = getmyrot(%trans);
// bascially add 100 to the z position of the old player, putting it up in the air
%newtrans= (%x SPC %y SPC %z+100 SPC %rot);
%client.camera.setTransform(%newtrans);
%client.camera.setCameraSubject(%client.player);and then setting the bounding box in the giant's datablock to an obscene amount, like 100 100 100
But walking and getting around is difficult.....the bounding box seems to be getting in the way.
#9
so in your example, I set the "regular cam" as the control object and then once the small guy is deleted, I make the giant the control object? So in that instance, are you talking about the regular, main game camera? How do I access the name of that?
02/26/2010 (3:44 pm)
@Realm X:so in your example, I set the "regular cam" as the control object and then once the small guy is deleted, I make the giant the control object? So in that instance, are you talking about the regular, main game camera? How do I access the name of that?
#10
what you suggested works perfectly.
I just used %client.camera for the main camera
so to summarize
1. I set control object to client.camera
2. I deleted old player
3. I set control object to giant.
The problem is now simply a bounding box problem. the bottom of him falls through the ground and I get stuck. How do I fix this?
Its higher when i set the bounding box in the giant's datablock to an obscene amount, like 100 100 100 But walking and getting around is difficult.....the bounding box seems to be getting in the way and it also gets stuck.
02/26/2010 (4:04 pm)
@Realm X:what you suggested works perfectly.
I just used %client.camera for the main camera
so to summarize
1. I set control object to client.camera
2. I deleted old player
3. I set control object to giant.
The problem is now simply a bounding box problem. the bottom of him falls through the ground and I get stuck. How do I fix this?
Its higher when i set the bounding box in the giant's datablock to an obscene amount, like 100 100 100 But walking and getting around is difficult.....the bounding box seems to be getting in the way and it also gets stuck.
#11

I started a new thread to talk about it:
www.torquepowered.com/community/forums/viewthread/111745
02/26/2010 (4:37 pm)
So the "eye point" is a side issue... the real issue now seems to be a bounding box issue..... and the fact that despite the prescene of a "cam" node, the engine seems to want to put the camera at the bounding box pivot point. 
I started a new thread to talk about it:
www.torquepowered.com/community/forums/viewthread/111745
#12
The problem seems to be more than an eye node not being found - if that's the case, the camera should render at the centre of the shape's object box, not at its base. Unless I'm misreading the code:
02/26/2010 (10:16 pm)
Unless this is an AFX issue, try stepping through Player::getRenderEyeTransform to see where the problem is. That should be the function called to get the position of the camera in first-person view.The problem seems to be more than an eye node not being found - if that's the case, the camera should render at the centre of the shape's object box, not at its base. Unless I'm misreading the code:
Point3F center; mObjBox.getCenter(¢er); MatrixF eyeMat(true); eyeMat.setPosition(center);
#13
Its the THIRD PERSON cam that is the issue.
This may be an AFX issue. I am using AFX. Good point. I don't know.
In that case, I may need to contact Jeff. I'm really at a loss.
Here is the AFX version of that function here, but this function does not seem to be the issue:
02/26/2010 (11:58 pm)
AH.... THAT'S AN IMPORTANT DISTINCTION.... the first person cam for the giant works. Its the THIRD PERSON cam that is the issue.
This may be an AFX issue. I am using AFX. Good point. I don't know.
In that case, I may need to contact Jeff. I'm really at a loss.
Here is the AFX version of that function here, but this function does not seem to be the issue:
void Player::getRenderEyeTransform(MatrixF* mat)
{
// Eye transform in world space. We only use the eye position
// from the animation and supply our own rotation.
MatrixF pmat,xmat,zmat;
xmat.set(EulerF(mHead.x, 0.0f, 0.0f));
zmat.set(EulerF(0.0f, 0.0f, mHead.z));
pmat.mul(zmat,xmat);
F32 *dp = pmat;
F32* sp;
if (mDataBlock->eyeNode != -1)
{
sp = mShapeInstance->mNodeTransforms[mDataBlock->eyeNode];
}
else
{
Point3F center;
mObjBox.getCenter(¢er);
MatrixF eyeMat(true);
eyeMat.setPosition(center);
sp = eyeMat;
}
const Point3F& scale = getScale();
dp[3] = sp[3] * scale.x;
dp[7] = sp[7] * scale.y;
dp[11] = sp[11] * scale.z;
mat->mul(getRenderTransform(), pmat);
}
#14
02/27/2010 (3:34 am)
ok I fixed it by just manually adjusting all the variables when I do the player switch. I push the camera back and adjust the pitch:%distance = %client.camera.getThirdPersonDistance(); %distance += 5; %client.camera.setThirdPersonDistance(%distance); %amt = 0.7; $mvPitch += %amt; $accum_pitch += %amt;
#15
02/27/2010 (2:03 pm)
Quote:the first person cam for the giant works.Ooh, sorry about that. Hmm, glad you fixed it though.
Torque 3D Owner RealmX