I'm trying to port one of my projects to Bepu but I've stumbled on some walls.
The project had a Movable3DObject class that was very, VERY similar to the Entity class, with just two significant differences. How they handle AngularVelocity and having a Model property.
First hit on the wall: AngularVelocity (AV from now on). Bepu uses a Vector3 to represent AV, previously I was using a Quaternion to represent it. Here is what I was doing to change the AV.
Code: Select all
Quaternion angularVelocityChange = Quaternion.CreateFromAxisAngle(-Vector3.Up, yaw * time);
//do some other stuff with angularVelocityChange such as changing pitch an roll
AngularVelocity *= angularVelocityChange;
Orientation *= AngularVelocity * time;
Code: Select all
AngularVelocity += new Vector(0, 0, rotate * time);
Two questions about this. How to accomplish a relative rotation with what I have (yaw, pitch, roll changes)? and, why use a Vector3 instead of a Quaternion to represent AV?
Second wall (this is a little one): The Entity class. It doesn't have a reference to a Model. Is this intended? The class I am using is extending it so it doesn't make much difference to me but it seems like such a common thing to have that makes me wonder if I'm not missing something obvious.
Third wall: Extending the Entity class. My first attempt to integrate Bepu was by making my class extend Bepu's Entity class, this resulted in null pointer exception when adding it to the Space. I then simply changed my class to extend Box and changed it's constructor accordingly, worked. Puzzled by this I made sure to set all properties that were being set in the Box constructor to the Entity extended version of my class. Only Position and Mass were available at the Entity class and they were already being set. Still the null pointer exception. So, shouldn't I inherit directly from Entity? I have to use some of Prefabs classes? It makes sense if I imagine that Bepu can only handle things that have a shape, like the Prefabs classes, but well, having just started with Bepu this weekend I'm a bit insecure and in need of confirmation.
I appreciate any help.