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 :
And now move on Z, same method not same result :
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!