Problem with xors3d

Blitz3D Forums/Blitz3D Userlibs/Problem with xors3d

Leon Drake(Posted 2010) [#1]
great job on Xors3d i have to say its such an awesome step up from blitz3d. However I have one small issue with Xors that is hindering me from using the product. The issue is parenting a Bone from one entity to another doesn't seem to affect the children at all.

In blitz3d i can load a B3d model that contains no geometry only a skeleton. Then i Load another B3d model that contains A Skin rigged Torso and arms along with a partial skeleton.

In normal B3d i can iterate through all the bones in the Torso model and pass entityparent and force those bones to become children of the same bones (by name) in the skeleton model. Then when i animate only the skeleton Entity it causes the Torso to move as well. I noticed i couldnt get this to work in Xors. The main reason i do this is because by having a seperate skeleton model doing the animations i can combine Morph animations on the geometry. This is a big need in my game and i'd love to port it over to Xors3d.

If this is something that can be emulated in xors3d?


Xors Team(Posted 2010) [#2]
We have answered this question via email.
However, probably, it can be useful for others.

In Xors3d you can assign various animation sequences to different parts of the animated mesh without the need of their assignment to some other skeletons. To do this use the last parameter (rootBone) of all the animation functions (see 'Entity animation' section of documentation). This parameter is the name of the bone starting from which the animation will be applied. For instance, you want to assign a 'shooting' animation to the torso and a 'running' animation to the legs. To do this you can use the following code (Blitz3D):
model = xLoadAnimModel("soldier.b3d")
run = xExtractAnimSet(model, 0, 30)
shoot = xExtractAnimSet(model, 31, 60)
xAnimate model, ANIMATION_LOOP, 1.0, shoot, 0.0, "torso"
xAnimate model, ANIMATION_LOOP, 1.0, run, 0.0, "pelvis"
; assuming that soldier.b3d has 'torso' and 'pelvis' bones and a proper skeleton

In this way a 'shooting' animation is assigned to the hierarchy of the bones starting from 'torso', and a 'running' animation is assigned to the hierarchy of the bones starting from 'pelvis'.


Mike0101(Posted 2010) [#3]
This is a very importnat feature what missing from blitzbasic.
I would like to buy and use Xors but I can't install the free version.
I'm getting errors always. I'm using the latest version of blitz and directx.


Leon Drake(Posted 2010) [#4]
Yea i was considering doing it that way, i guess the prob is trying to play a morph animation AND a skeletal animation at the same time. that is why i assigned the second models bones as children of the first model's bones so i can play morph and skeletal animations at the same time.


Xors Team(Posted 2010) [#5]
@Mike0101
What kind of errors do you get?

@Leon Drake
I am afraid I didn't understand you clearly. Can you send us via email a code sample with a model to show what are you trying to achieve?


Mike0101(Posted 2010) [#6]
I'm using the latest dll set of xors and 1.105 of blitz.
Error: User lib function not found for xSetEntityeffect_ function.

Other question: Are you sure then each command of blitz is transported to xors?
In theory I have to modify the commands for xCommand and work fine.


Leon Drake(Posted 2010) [#7]
ok here is a snippet,

Function addtoskeleton(p.ProductMesh,s.ProductSkeleton)

	
		PositionEntity p\part,EntityX(s\skeleton),EntityY(s\skeleton),EntityZ(s\skeleton)
		getchildren(p\part)
		getchildren(s\skeleton)
		For c.child = Each child
			If c\parentmesh = p\part Then
				For x.child = Each child
					If x\parentmesh = s\skeleton Then
						If EntityName(x\child) = EntityName(c\child) Then
							 DebugLog "Attaching "+EntityName(c\child)+" to "+EntityName(x\child)
				
							EntityParent(c\child,0)
							
							PositionEntity c\child,EntityX(x\child,True),EntityY(x\child,True),EntityZ(x\child,True)
							
							
							RotateEntity c\child,EntityPitch(x\child,True),EntityYaw(x\child,True),EntityRoll(x\child,True)
							
							EntityParent(c\child,x\child)
							
				
							Exit
						EndIf
					EndIf
				Next
			EndIf
		
		Next
		EntityParent(p\part,s\skeleton)

		

	
	For c.child = Each child 
	Delete c
	Next
	
End Function


Type child

	Field child
	Field parentmesh

End Type


Function getchildren(ent)
	entp = ent
	While ent
		c.child = New child
		c\child = ent
		c\parentmesh = entp
		ent = NextChild(ent)
	Wend

End Function

;NextChild() function by Beaker
Function NextChild(ent)
		Local siblingcnt
		If CountChildren(ent)>0
			Return GetChild(ent,1)
		EndIf
	
		Local foundunused=False
		Local foundent = 0, parent,sibling
		While foundunused=False And ent<>0
			parent = GetParent(ent)
			If parent<>0
				If CountChildren(parent)>1
					If GetChild(parent,CountChildren(parent))<>ent
						For siblingcnt = 1 To CountChildren(parent)
							sibling = GetChild(parent,siblingcnt)
							If sibling=ent
								foundunused = True
								foundent = GetChild(parent,siblingcnt+1)
							EndIf
						Next
					EndIf
				EndIf
			EndIf
			ent = parent
		Wend
		Return foundent
End Function


Basically what is happening I have a Skeleton B3d file which contains all the bones i will use for all my animations. Then I have a Mesh file, say its a Shirt Mesh that will get attached to the skeleton. This allows me to swap out body parts to make a configurable character. What is great about Blitz3d is (as you can see in the code) I can take all the Bones from my Mesh and Attach them to the same bones in the skeleton file using Entityparent. By doing this i only have to Animate the Base skeleton Mesh to affect ALL of the children meshes. Then since i am only affecting the Base skeleton i can separately animate the other meshes i attach which contain morphs without affecting the bone animation.


However sadly this function above does not work in Xors3d.


Leon Drake(Posted 2010) [#8]
I find it odd though the only engines i have found that can emulate this is Ogre3d, Cal3d and Unity3d

All of those use a seperate Skeleton mesh where geometry can be added and removed dynamically and only the skeleton has to be animated. This is more or less what i was able to achieve using blitz3d, but it seems Minib3d, irrlicht and Xors3d can't exactly emulate this behaivor without crashing or breaking the mesh.


Danny(Posted 2011) [#9]
Sorry to bump this up Leon, but I happen to find myself in the exact same situation at the moment :)
Did you ever manage to resolve this problem and do it your way using the separate skeleton with XOrs3D?


Leon Drake(Posted 2011) [#10]
no i didn't sadly :( as of late i have been porting all of my projects over to unity as the engine offers everything i need.

Not just because of the bone issue but because there really doesn't look like any prospect of B3d being updated to DX9, that and it looks as though its been continually having more and more problems with Windows 7

Last edited 2011


Leon Drake(Posted 2012) [#11]
Sorry to necro this but apparently this was fixed in Xors3d and no ever ever told me *cries*


Danny(Posted 2013) [#12]
Nope - and most unfortunately, this has NOT been resolved in Xors3D (yet?) and people are still struggling to come with some solution:
http://area.xors3d.com/forums/viewtopic.php?f=5&t=1005

The good news though is that Squid is back - so there might still be hope this would get fixed one day. Which would be very cool indeed, because it's a total show-stopper for me as well...