Search found 11 matches
- Sun Feb 03, 2013 6:12 am
- Forum: Questions and Help
- Topic: Weld one entity to another on collision
- Replies: 24
- Views: 22916
Re: Weld one entity to another on collision
Either transform the arrow position by the inverse world transform directly Thanks again Norbo! The above worked for me. For those in the future who may stumble upon this thread, this worked for me: arrow.Offset = Vector3.Transform(arrow.PhysObj.WorldTransform.Translation,Matrix.Invert(target.PhysO...
- Sat Feb 02, 2013 7:10 am
- Forum: Questions and Help
- Topic: Weld one entity to another on collision
- Replies: 24
- Views: 22916
Re: Weld one entity to another on collision
arrow.Offset is computed as a world offset here, and the Orientation is just the world space orientation of the arrow (Matrix.Identity * something = something). This should be changed to compute the orientation of the arrow in the local space of the StuckTo entity, and transform the world offset in...
- Fri Feb 01, 2013 6:45 am
- Forum: Questions and Help
- Topic: Weld one entity to another on collision
- Replies: 24
- Views: 22916
Re: Weld one entity to another on collision
I hate to keep beating this thread to death but the matrix math is driving me insane! I have this event handler for when an arrow first hits a target: void Events_InitialCollisionDetected(BEPUphysics.Collidables.MobileCollidables.EntityCollidable sender, BEPUphysics.Collidables.Collidable other, BEP...
- Wed Jan 23, 2013 6:43 pm
- Forum: Questions and Help
- Topic: Weld one entity to another on collision
- Replies: 24
- Views: 22916
Re: Weld one entity to another on collision
Thanks Norbo! I finally got it right: Vector3 vel = PhysObj.LinearVelocity; if (vel != Vector3.Zero) { vel.Normalize(); Vector3 forward = PhysObj.WorldTransform.Forward; Quaternion result; Toolbox.GetQuaternionBetweenNormalizedVectors(ref forward, ref vel, out result); Quaternion curQuat = PhysObj.O...
- Wed Jan 23, 2013 8:36 am
- Forum: Questions and Help
- Topic: Weld one entity to another on collision
- Replies: 24
- Views: 22916
Re: Weld one entity to another on collision
I like the idea of your second approach, but I think I'm doing that wrong too.... Here's what I have: Vector3 vel = PhysObj.LinearVelocity; vel.Normalize(); Vector3 forward = PhysObj.WorldTransform.Forward; forward.Normalize(); Quaternion result = new Quaternion(); Toolbox.GetQuaternionBetweenNormal...
- Wed Jan 23, 2013 8:16 am
- Forum: Questions and Help
- Topic: Weld one entity to another on collision
- Replies: 24
- Views: 22916
Re: Weld one entity to another on collision
The easiest way would be to just grab the Forward (or Right, or Left) vector from the entity's OrientationMatrix. There's a property for them. This is equivalent to taking something like (0,0,1) and transforming it by the rotation matrix, except because a rotation matrix is an orthonormal basis, yo...
- Wed Jan 23, 2013 7:07 am
- Forum: Questions and Help
- Topic: Weld one entity to another on collision
- Replies: 24
- Views: 22916
Re: Weld one entity to another on collision
One option would be to control the orientation of the arrow based upon the linear velocity. Align the local forward vector of the arrow with the linear velocity direction. Beware of the zero-velocity singularity. How would I go about doing this exactly? I've tried calculating a set of angle for ori...
- Mon Jan 14, 2013 10:37 pm
- Forum: Questions and Help
- Topic: Weld one entity to another on collision
- Replies: 24
- Views: 22916
Re: Weld one entity to another on collision
Another solution I found was to check if the entity.space property was null. Is there any snafus with that (other than efficiency and extra events firing)?
So I can remove the entity from just the Space.SpaceObjectBuffer? Or do I need to do both Space and Space.SpaceObjectBuffer?
So I can remove the entity from just the Space.SpaceObjectBuffer? Or do I need to do both Space and Space.SpaceObjectBuffer?
- Sun Jan 13, 2013 8:06 am
- Forum: Questions and Help
- Topic: Weld one entity to another on collision
- Replies: 24
- Views: 22916
Re: Weld one entity to another on collision
Norbo mentioned removing the arrow's Box from the Space as a simple solution. I'm attempting that... I am hooked onto the arrow's InitialCollisionDetected event. When that fires I do space.Remove(sender.Entity). This works fine for a while, but if I get going shooting arrows rapid style I get an exc...
- Wed Oct 24, 2012 4:22 am
- Forum: Questions and Help
- Topic: Spinning camera
- Replies: 2
- Views: 3105
Re: Spinning camera
Perfect! Thanks! That fixed the mouse look.
I love this physics engine by the way!
I love this physics engine by the way!
- Wed Oct 24, 2012 3:21 am
- Forum: Questions and Help
- Topic: Spinning camera
- Replies: 2
- Views: 3105
Spinning camera
I'm trying to adopt the DemoGames Camera class into my game (I like how elegant it is compared to my brute camera). When I load into my world, the camera seems to be spinning like crazy! I can move my mouse around and eventually slow it to see my world is rendering fine. Any ideas what could be caus...