feanor91
19-09-2008 07:53:27
Hello
I manage to find a free model of character on the net (there is few), but I have a very big problem : it's facing Z axis by default. under Max, I can't make it facing X axis because link between mesh and skeleton are broken. The probleme is tht when it pass under OGRE, it has always a rotation applied so when I get is quaternion for getting orientation, I get a bad quaternion because my character is not oriented in right way after rotation to put it in direction where I want it to go. I found a way by reseting it's position on every direction change then calculate new orientation then pitching and yawing to make it stand up on the ground but this method didn't work if I move it on Z axis (it's laying on the ground when advancing.
I'm very busy by the way, theres one week I look after a solution but didn' tmanage to find one....Please help me.
This is my Next Location Function :
Here's some pictures. First move on X then circle, it's OK with my method :
![](http://img144.imageshack.us/img144/1160/screenshot01bc4.th.jpg)
![](http://img509.imageshack.us/img509/5474/screenshot02cb1.th.jpg)
![](http://img144.imageshack.us/img144/346/screenshot03ev7.th.jpg)
![](http://img521.imageshack.us/img521/5726/screenshot04sf6.th.jpg)
![](http://img522.imageshack.us/img522/364/screenshot05lf7.th.jpg)
![](http://img522.imageshack.us/img522/3566/screenshot07vb5.th.jpg)
![](http://img525.imageshack.us/img525/7522/screenshot07wx0.th.jpg)
And now move on Z, same method not same result :
![](http://img172.imageshack.us/img172/1213/screenshot08ev1.th.jpg)
![](http://img172.imageshack.us/img172/7017/screenshot09ji1.th.jpg)
![](http://img171.imageshack.us/img171/2438/screenshot10kf6.th.jpg)
![](http://img229.imageshack.us/img229/9118/screenshot11wz3.th.jpg)
And so on....AU SECOUR!
I manage to find a free model of character on the net (there is few), but I have a very big problem : it's facing Z axis by default. under Max, I can't make it facing X axis because link between mesh and skeleton are broken. The probleme is tht when it pass under OGRE, it has always a rotation applied so when I get is quaternion for getting orientation, I get a bad quaternion because my character is not oriented in right way after rotation to put it in direction where I want it to go. I found a way by reseting it's position on every direction change then calculate new orientation then pitching and yawing to make it stand up on the ground but this method didn't work if I move it on Z axis (it's laying on the ground when advancing.
I'm very busy by the way, theres one week I look after a solution but didn' tmanage to find one....Please help me.
This is my Next Location Function :
Public Function NextLocation() As Boolean
If WalkList.Count = 0 Then Return False
Dim Redresse As Mogre.Degree = New Mogre.Degree(90)
Dim Recule As Mogre.Degree = New Mogre.Degree(180)
Dim quat As Quaternion
'Get next location from walk list
myDestination = WalkList.Dequeue
myDirection = myDestination - myNode.Position
MyDistance = myDirection.Normalise
'Change orientation to face new location
myNode.ResetOrientation()
Dim src As Vector3 = myNode.Orientation * Vector3.UNIT_Z
If 1 + src.DotProduct(myDirection) < 0.0001 Then
myNode.Yaw(New Degree(180))
Else
quat = src.GetRotationTo(myDirection)
myNode.Rotate(quat)
CVNode.ResetOrientation()
CVNode.Rotate(quat)
src = myNode.Orientation * New Mogre.Vector3(1, 100, -500) + myNode.Position
CVNode.Position = src
CVNode.Pitch(New Mogre.Degree(90))
CVNode.Yaw(New Mogre.Degree(-90))
myNode.Pitch(Redresse)
myNode.Roll(Recule)
End If
Return True
End Function
Here's some pictures. First move on X then circle, it's OK with my method :
And now move on Z, same method not same result :
And so on....AU SECOUR!