[all fixed]Animated Mesh changes

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

[all fixed]Animated Mesh changes

Post by wing64 »

1. Maybe void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs) have a
getMeshForCurrentFrame() function redundant (call twice in 1.OnAnimate() & 2.render()), isn't it ? I try delete that function at OnAnimate() function and test result is ok. Suggest me if i'm wrong.

Old OnAnimate

Code: Select all

void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
{
	buildFrameNr(timeMs-LastTimeMs);

	if (Mesh)
	{
		scene::IMesh * mesh = getMeshForCurrentFrame();

		if (mesh)
			Box = mesh->getBoundingBox();
	}
	LastTimeMs = timeMs;

	IAnimatedMeshSceneNode::OnAnimate ( timeMs );
}
New OnAnimate

Code: Select all

void CAnimatedMeshSceneNode::OnAnimate(u32 timeMs)
{
	buildFrameNr(timeMs-LastTimeMs);

	LastTimeMs = timeMs;

	IAnimatedMeshSceneNode::OnAnimate ( timeMs );
}
2. Request feature. Could you add function setTransitionTime() with zero for disable transition time ?
Old setTransitionTime

Code: Select all

void CAnimatedMeshSceneNode::setTransitionTime(f32 time)
{
	if (time != 0.0f)
	{
		checkJoints();
		setJointMode(EJUOR_CONTROL);
		TransitionTime = (u32)core::floor32(time*1000.0f);
	}
}
New setTransitionTime

Code: Select all

void CAnimatedMeshSceneNode::setTransitionTime(f32 time)
{
	if (time != 0.0f)
	{
		checkJoints();
		setJointMode(EJUOR_CONTROL);
		TransitionTime = (u32)core::floor32(time*1000.0f);
	}
	else if (time == 0.0f)
	{
		checkJoints();
		setJointMode(EJUOR_NONE);
		TransitionTime = 0;
	}
}
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I think the Box update in OnAnimate is necessary for proper bbox culling of the node. This would be too late in render(). A better thing for speedup would be to cache the result of OnAnimate in a temporary mesh, but that's quite memory consuming which is why it has not been implemented.
For the transition time: I honestly don't know which values have to be set, but your request seems to be valid. Is the checkJoints() necessary at that point?
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Post by wing64 »

Thanks hybrid for reply.
1. You right, Bbox be too late update if getMeshForCurrentFrame() only in render().
2. No checkjoint() isn't necessary. Purpose of set transition time to zero is use with ragdoll. TransitionTime need set to zero when user switch between ragdoll mode and back to irrlicht animation mode.
3. setRenderFromIdentity() not good choice when user draw ragdoll with changed position rotation and scale.
4. When changed mesh with setMesh() this class not update JointChildSceneNodes. Bug founded when call getJointNode() after changed new mesh. Class will return old mesh joint.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, transition time can now be set to 0 again. Also getJointNode returns the correct node after setMesh now.
I don't understand what you mean with 3. Please explain further.
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Post by wing64 »

Thank you hybrid, Ragdoll can't move, scale or rotation mesh when enable setRenderFromIdentity() because driver set world matrix with IdentityMatrix.
If user need transformation ragdoll with another position, scale or rotation then user need AbsoluteTransformation for transform that.
Therefore the above reasons should not be recommended setRenderFromIdentity() for render mesh with ragdoll. If i wrong please suggest me. :D
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, comment fixed.
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Post by wing64 »

Thanks again Hybrid.
Post Reply