begginer need help
Posted: Mon Jul 04, 2011 6:06 am
hi every one i'm new in bepu and xna
i'm trying to make my first step in bepu, i'm using xna4 and the newer version of bepu 0.16 , what i want to do is put one box(entity) and attach a cube model to it , then when game is running i want the etity falling to the ground , actualy i'm try to do that but the entity still in it's position whitout falling on the ground , i was attach the model with entity position (using the world matrix) . and i was also write a code for static mesh (ground) for collision with that box , here is my code:
using BEPUphysics;
using BEPUphysics.DataStructures;
using BEPUphysics.Entities;
using BEPUphysics.Collidables;
using BEPUphysics.MathExtensions;
using BEPUphysics.Entities.Prefabs;
// variable
Space space;
Vector3 cubeBoxPos;
// load content
cube = Content.Load<Model>("E/cube");
space = new Space();
space.ForceUpdater.Gravity = new Vector3(0, -9.8f, 0);
Vector3[] vertices;
int[] indices;
TriangleMesh.GetVerticesAndIndicesFromModel(ground_w_d, out vertices, out indices);
var mesh_level = new StaticMesh(vertices, indices, new AffineTransform(new Vector3(0, 0, 0)));
Box cubeBox;
cubeBoxPos = new Vector3(0, 20, 20);
cubeBox = new Box(cubeBoxPos, 1, 1, 1, 1);
space.Add(cubeBox);
space.Add(mesh_level);
// update
space.Update();
System.Diagnostics.Debug.WriteLine(cubeBoxPos);// to know the position of box entity
where is the wrong ?
thanx for any one need to help.

i'm trying to make my first step in bepu, i'm using xna4 and the newer version of bepu 0.16 , what i want to do is put one box(entity) and attach a cube model to it , then when game is running i want the etity falling to the ground , actualy i'm try to do that but the entity still in it's position whitout falling on the ground , i was attach the model with entity position (using the world matrix) . and i was also write a code for static mesh (ground) for collision with that box , here is my code:
using BEPUphysics;
using BEPUphysics.DataStructures;
using BEPUphysics.Entities;
using BEPUphysics.Collidables;
using BEPUphysics.MathExtensions;
using BEPUphysics.Entities.Prefabs;
// variable
Space space;
Vector3 cubeBoxPos;
// load content
cube = Content.Load<Model>("E/cube");
space = new Space();
space.ForceUpdater.Gravity = new Vector3(0, -9.8f, 0);
Vector3[] vertices;
int[] indices;
TriangleMesh.GetVerticesAndIndicesFromModel(ground_w_d, out vertices, out indices);
var mesh_level = new StaticMesh(vertices, indices, new AffineTransform(new Vector3(0, 0, 0)));
Box cubeBox;
cubeBoxPos = new Vector3(0, 20, 20);
cubeBox = new Box(cubeBoxPos, 1, 1, 1, 1);
space.Add(cubeBox);
space.Add(mesh_level);
// update
space.Update();
System.Diagnostics.Debug.WriteLine(cubeBoxPos);// to know the position of box entity
where is the wrong ?
thanx for any one need to help.