Scorch
05-03-2007 01:18:27
This is probably an OgreNewt beginner question, but I am having problems aligning my body objects with my visible mesh's.
I've tried several things over the past two days, and its time to ask for help I think.
Attempt 1: Capsule
Create a ChildSceneNode
Attach Entity to the node
Create a capsule roughly the size of my model.
create a body using said capsule.
Set position, orientation, masMatrix, standardForceCallback of body
Attach to the same node my entity is attached to.
Problem: This had the problem where my capsule was on its side. When I set its orientation to 90 degrees, it moved the mesh with it. so the my capsule was upright, but my mesh was on its side.
Attempt 2: Elipsoid
Create a ChildSceneNode
Attach Entity to the node
create an elipsoid using the bounding box size of my mesh
create a body object using the elipsoid
Set position, orientation, masMatrix, standardForceCallback of body
Attach to the same node my entity is attached to.
Problem:
The body is not centered on the bottom of my mesh. I tried using different values of initial position when I called setPositionOrientation() but this moved my mesh by the same distance.
Attempt 3: Elipsoid + 2 nodes
Create a childSceneNode.
Create a second childSceneNode (child of the first).
Attach mesh to the second node.
create an elipsoid using the bounding box size of my mesh
create a body object using the elipsoid
Set position, orientation, masMatrix, standardForceCallback of body
Attach to first (parent) node.
Problem:
With this method I can allign the mesh with my body, but now when the body moves in effect to gravity, it leaves my mesh behind! ... When a body moves the parent node, shouldn't the child node follow?
Context:
The mesh I am using is a poorly made female human. The scale is way to big but I can fix that later.
Suggestions?
Is there a "Right" way to do this?
/Edit
Attempt 4:
I tried Attempt 2 but this time I moved the node after setting everything up. I found another post that said moving the node shouldn't move the body. But in my case moving the node moves both the body and the mesh ...
I've tried several things over the past two days, and its time to ask for help I think.
Attempt 1: Capsule
Create a ChildSceneNode
Attach Entity to the node
Create a capsule roughly the size of my model.
create a body using said capsule.
Set position, orientation, masMatrix, standardForceCallback of body
Attach to the same node my entity is attached to.
Problem: This had the problem where my capsule was on its side. When I set its orientation to 90 degrees, it moved the mesh with it. so the my capsule was upright, but my mesh was on its side.
Attempt 2: Elipsoid
Create a ChildSceneNode
Attach Entity to the node
create an elipsoid using the bounding box size of my mesh
create a body object using the elipsoid
Set position, orientation, masMatrix, standardForceCallback of body
Attach to the same node my entity is attached to.
Problem:
The body is not centered on the bottom of my mesh. I tried using different values of initial position when I called setPositionOrientation() but this moved my mesh by the same distance.
Attempt 3: Elipsoid + 2 nodes
Create a childSceneNode.
Create a second childSceneNode (child of the first).
Attach mesh to the second node.
create an elipsoid using the bounding box size of my mesh
create a body object using the elipsoid
Set position, orientation, masMatrix, standardForceCallback of body
Attach to first (parent) node.
Problem:
With this method I can allign the mesh with my body, but now when the body moves in effect to gravity, it leaves my mesh behind! ... When a body moves the parent node, shouldn't the child node follow?
Context:
The mesh I am using is a poorly made female human. The scale is way to big but I can fix that later.
Suggestions?
Is there a "Right" way to do this?
/Edit
Attempt 4:
I tried Attempt 2 but this time I moved the node after setting everything up. I found another post that said moving the node shouldn't move the body. But in my case moving the node moves both the body and the mesh ...