T3D 1.1 Beta 3 - EyePoint Does Not Update With Player Pose - RESOLVED
by Steve Acaster · in Torque 3D Professional · 10/31/2010 (10:51 pm) · 27 replies
T3D 1.1 beta 3
Win7
Target
player, eyepoint, math
Issue
%player.getEyePoint(); - the eyepoint does not appear to update with the player's stance/pose. So if the player crouches ($mvTriggerCount3++;) any math or vector which uses the EyePoint, will not update to the new eye position and will use the original (standing) eye position. Sometimes, I've also found it stuck in location where it should be in crouch too and not back at root animation/stand pose location.
Repeat
In-game, get the player's eyePoint, then have them crouch and get the player's eyepoint again - notice no difference even though the eyeNode has moved position with the crouch animation.
Suggest
Have the server update the eyePosition correctly with the current position of the eyeNode.
edit
10 April 2011 Looks fixed in 1.1 Preview
Not fixed in 1.1 Final 08 Aug 2011 ... but that could be intentional
Win7
Target
player, eyepoint, math
Issue
%player.getEyePoint(); - the eyepoint does not appear to update with the player's stance/pose. So if the player crouches ($mvTriggerCount3++;) any math or vector which uses the EyePoint, will not update to the new eye position and will use the original (standing) eye position. Sometimes, I've also found it stuck in location where it should be in crouch too and not back at root animation/stand pose location.
Repeat
In-game, get the player's eyePoint, then have them crouch and get the player's eyepoint again - notice no difference even though the eyeNode has moved position with the crouch animation.
Suggest
Have the server update the eyePosition correctly with the current position of the eyeNode.
edit
10 April 2011 Looks fixed in 1.1 Preview
Not fixed in 1.1 Final 08 Aug 2011 ... but that could be intentional
About the author
One Bloke ... In His Bedroom ... Making Indie Games ...
#2
11/04/2010 (10:42 pm)
GetMuzzlePoint() also doesn't update with the actual muzzlepoint if the player is crouched.
#4
02/06/2011 (3:57 am)
The same goes for all the attached mountpoints mount0....
#5
can you guys check something, if you fire a single shot, do they update?
like, in crouch, fire a shot, does the eyepoint then update?
I am having a huge amount of trouble with this same issue. I noticed, for me, at least, a single shot sends the updates.
I have no clue what it is about firing that one shot, but something gets sent across...
please, bugbusters, have a look at this one??
02/06/2011 (5:17 am)
Quote:In-game, get the player's eyePoint, then have them crouch and get the player's eyepoint again - notice no difference even though the eyeNode has moved position with the crouch animation.
Quote:GetMuzzlePoint() also doesn't update with the actual muzzlepoint if the player is crouched
Quote:The same goes for all the attached mountpoints mount0....
can you guys check something, if you fire a single shot, do they update?
like, in crouch, fire a shot, does the eyepoint then update?
I am having a huge amount of trouble with this same issue. I noticed, for me, at least, a single shot sends the updates.
I have no clue what it is about firing that one shot, but something gets sent across...
please, bugbusters, have a look at this one??
#6
Confirmed!!
The eyepoint and the mount0 .. are updated after you fire a shot.
My thought is that there is an update of these points necessary after a pose change.
I'll dig in the code to see if I can find out what is happening.
02/06/2011 (7:20 am)
Quote:can you guys check something, if you fire a single shot, do they update?
like, in crouch, fire a shot, does the eyepoint then update?
Confirmed!!
The eyepoint and the mount0 .. are updated after you fire a shot.
My thought is that there is an update of these points necessary after a pose change.
I'll dig in the code to see if I can find out what is happening.
#7
that would be great Richard,
I tried and got hopelessly lost!!
pose change has no effect, btw.
the single shot will always send the update.
but what update?
02/06/2011 (9:41 am)
Quote:I'll dig in the code to see if I can find out what is happening.
that would be great Richard,
I tried and got hopelessly lost!!
pose change has no effect, btw.
the single shot will always send the update.
but what update?
#8
At the bottom of setPose(),try with this one:
if(!isGhost())
mShapeInstance->animate();
02/06/2011 (10:04 am)
May be it is not an update.At the bottom of setPose(),try with this one:
if(!isGhost())
mShapeInstance->animate();
#9
adding it to the bottom of updateMove, below
02/06/2011 (10:32 am)
mmm, just tried that, still takes a single shot to pass the update....adding it to the bottom of updateMove, below
setPose( desiredPose );seems to have some effect though.
#10
I'm updating the nodes when a new pose is passed.It is wrong to update them all the time.
02/06/2011 (11:06 am)
Hmm.. this should work.void Player::setPose( Pose pose )
{
// Already the set pose, return.
if ( pose == mPose )
return;
if(!isGhost())
mShapeInstance->animate();
...
}I'm updating the nodes when a new pose is passed.It is wrong to update them all the time.
#11
02/06/2011 (11:45 am)
Ivan, still has to shoot to update the eyeNode position. :/bob.setpose=2; marker2.settransform(bob.geteyetransform());//fail! bob.shoot(); bob.ceasefire(); marker2.settransform(bob.geteyetransform());//win! bob.setpose=1; marker2.settransform(bob.geteyetransform());//fail! bob.shoot(); bob.ceasefire(); marker2.settransform(bob.geteyetransform());//win!
#12
Thanks for the suggestion, you're almost right.
A possible fix seems to be to following:
In player.cpp make add accordingly:
As far as I can see now this seems to work.
02/06/2011 (12:00 pm)
@Ivan:Thanks for the suggestion, you're almost right.
A possible fix seems to be to following:
In player.cpp make add accordingly:
void Player::getEyeTransform(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;
if(!isGhost()) // Add this line
mShapeInstance->animate(); // and this line
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;
MatrixF eyeMat(true);
if (mDataBlock->eyeNode != -1)
{
sp = mShapeInstance->mNodeTransforms[mDataBlock->eyeNode];
}
...As far as I can see now this seems to work.
#13
the root problem still needs to be attended to,
still dont know what that is....
02/06/2011 (12:07 pm)
that will work, but only for the eyeNode.the root problem still needs to be attended to,
still dont know what that is....
#14
EDIT
I find that getMuzzlePoint works fine
double edit
I also have animateOnServer set up (it's false on stock)
02/06/2011 (1:12 pm)
Couldn't you also add the snippet to getMuzzleTransform - at least as a workaround?EDIT
I find that getMuzzlePoint works fine
double edit
I also have animateOnServer set up (it's false on stock)
#15
Stock = no change in eyepoint or muzzlepoint.
With the getEyeTransform fix (not setPose) = eyepoint and muzzlepoint changes.
Stock = no getMountpointTransform function?
Unless someone wants to try this (courtesy of MaxGaming)
I've not tried this.
02/06/2011 (1:45 pm)
To note:Stock = no change in eyepoint or muzzlepoint.
With the getEyeTransform fix (not setPose) = eyepoint and muzzlepoint changes.
Stock = no getMountpointTransform function?
Unless someone wants to try this (courtesy of MaxGaming)
//change static shape to anything else eg player
void Player::getNodeTransform(const char* nodeName, MatrixF* mat)
{
S32 node = getShape()->findNode(nodeName);
MatrixF pmat;
pmat.identity();
F32 *dp = pmat;
if (node != -1)
{
F32* sp;
sp = mShapeInstance->mNodeTransforms[node];
const Point3F& scale = getScale();
dp[3] = sp[3] * scale.x;
dp[7] = sp[7] * scale.y;
dp[11] = sp[11] * scale.z;
}
mat->mul(getTransform(), pmat);
}
ConsoleMethod( Player, getNodePosition, const char*, 3, 3, "(slotname) returns the nodes position")
{
MatrixF mat;
object->getNodeTransform(argv[2], &mat);
Point3F pos(0,0,0);
mat.getColumn(3,&pos);
char* buff = Con::getReturnBuffer(100);
dSprintf(buff, 100,"%g %g %g",pos.x,pos.y,pos.z);
return buff;
}
//in .h after a public:
void getNodeTransform(const char* nodeName, MatrixF* mat);I've not tried this.
#16
02/06/2011 (2:24 pm)
If you try to pull a node position serverside,it will return the initial position.Animation advances on the client only,unless you do some special tricks as animate on server,which is disabled by default.
#17
could you point me in the right direction to do exactly that?
I need to animate server side procedural bones in rythm to the players animations.
your earlier fix here solved a major hurdle for me, the updating pose on the server.
but I need to run the sequences on the server to keep the procedural bones up with the anims.
02/06/2011 (3:23 pm)
@Ivan,could you point me in the right direction to do exactly that?
I need to animate server side procedural bones in rythm to the players animations.
your earlier fix here solved a major hurdle for me, the updating pose on the server.
but I need to run the sequences on the server to keep the procedural bones up with the anims.
#18
Before the pose is changed the geteyepoint function returns an incorrect coordinate until the player shoots. It isn't just happening when the pose is changed.
It is fairly close with the gideon model, but if you do a raycast to see whats infront before you shoot it doesn't quite work.
For eg geteyepoint will return:
334.273 -164.694 279.814 before you shoot and:
334.273 -164.683 279.816 after you shoot.
These numbers are fairly close but it does make a difference.
What exactly happens when a player shoots to change the eye position?
02/06/2011 (7:39 pm)
I posted a similar problem with Beta2 about 6 months ago. The account I used has been deleted and all those posts have also been deleted but it was logged.Before the pose is changed the geteyepoint function returns an incorrect coordinate until the player shoots. It isn't just happening when the pose is changed.
It is fairly close with the gideon model, but if you do a raycast to see whats infront before you shoot it doesn't quite work.
For eg geteyepoint will return:
334.273 -164.694 279.814 before you shoot and:
334.273 -164.683 279.816 after you shoot.
These numbers are fairly close but it does make a difference.
What exactly happens when a player shoots to change the eye position?
#19
Just in case you've not tried it already, check out the "realistic first person" resource.
02/06/2011 (7:45 pm)
@deepJust in case you've not tried it already, check out the "realistic first person" resource.
Associate David Montgomery-Blake
David MontgomeryBlake