Adding levels and a player (first person shooter)
Posted: Sun Mar 27, 2011 8:19 pm
Ok so I think I figured out the basics:
Create space object.
Add gravity
Add physics related things to space object
update physics every update
profit?
I think I have my .x level model correct:
I create my player object given the camera position then give it roughly the dimensions I think the player should be using a Box object.
I haven't been able to link the camera to the player physics object yet but I've been tracking the player's position. It's definitely doing some collision since it will only fall to 40y before it stops. If I take the level physics object out, It'll just keep going down. But I can't seem to stop the player when it comes in contact with a wall.
Maybe I'm not hooking up the player position with the physics position properly? What is the best way to do this?
Also, when I make a box, you feed it: vec3, float, float, float, float. The last float is for "m". What is m?
Create space object.
Add gravity
Add physics related things to space object
update physics every update
profit?
I think I have my .x level model correct:
and then add the staticmesh to the space object.Vector3[] staticTriangleVertices;
int[] staticTriangleIndices;
TriangleMesh.GetVerticesAndIndicesFromModel(m, out staticTriangleVertices, out staticTriangleIndices);
staticMesh = new StaticMesh(staticTriangleVertices, staticTriangleIndices, new AffineTransform(Matrix3X3.CreateFromAxisAngle(Vector3.Up, MathHelper.Pi), new Vector3(0, -10, 0)));
staticMesh.Sidedness = TriangleSidedness.Counterclockwise;
I create my player object given the camera position then give it roughly the dimensions I think the player should be using a Box object.
I haven't been able to link the camera to the player physics object yet but I've been tracking the player's position. It's definitely doing some collision since it will only fall to 40y before it stops. If I take the level physics object out, It'll just keep going down. But I can't seem to stop the player when it comes in contact with a wall.
Maybe I'm not hooking up the player position with the physics position properly? What is the best way to do this?
Also, when I make a box, you feed it: vec3, float, float, float, float. The last float is for "m". What is m?