Search found 99 matches
- Tue Jan 14, 2020 4:22 am
- Forum: Questions and Help
- Topic: Rotating parts of compound body
- Replies: 32
- Views: 74334
Re: Rotating parts of compound body
The overload that does not output a center performs no recentering and leaves the children in exactly the same relative position as they were added in. That original state generally won't be the 'true' center of mass in terms of the input shapes/weights, but sometimes that's desirable. This is what...
- Tue Jan 14, 2020 12:00 am
- Forum: Questions and Help
- Topic: Rotating parts of compound body
- Replies: 32
- Views: 74334
Re: Rotating parts of compound body
If the design origin and center of mass are not exactly the same, this might result in the connected body floating away from the surface it's supposed to be on, or being shunted forward or back, or in the worst case, shoved into the ship's body. Is there a way I can check where the design origin an...
- Mon Jan 13, 2020 2:26 am
- Forum: Questions and Help
- Topic: Rotating parts of compound body
- Replies: 32
- Views: 74334
Re: Rotating parts of compound body
Is Vector3.UnitY the correct direction for both connected bodies in their respective local spaces? UnitY is <0,1,0>, but to be honest I'm not sure what the "correct" direction would/should be... Is transform.localPosition correct in context? transform.localPosition is where I want the spi...
- Sat Jan 11, 2020 2:35 am
- Forum: Questions and Help
- Topic: Rotating parts of compound body
- Replies: 32
- Views: 74334
Re: Rotating parts of compound body
So I switched to the Hinge constraint, which I was initializing like so: new Hinge() { LocalHingeAxisA = Vector3.UnitY, LocalHingeAxisB = Vector3.UnitY, LocalOffsetA = transform.localPosition, LocalOffsetB = Vector3.Zero, SpringSettings = new SpringSettings(10, 1) }; But after adding it to the simul...
- Thu Jan 09, 2020 1:39 am
- Forum: Questions and Help
- Topic: Rotating parts of compound body
- Replies: 32
- Views: 74334
Re: Rotating parts of compound body
What's the best way of achieving positional behavior like what you get if you make a body part of a compound, but with constraints? I have a body which I'd like to rotate around its local Y axis only and keep in the same local position (restrict all linear movement compared to the main ship's compou...
- Tue Dec 10, 2019 6:54 pm
- Forum: Questions and Help
- Topic: Rotating parts of compound body
- Replies: 32
- Views: 74334
Rotating parts of compound body
So I'm currently working on making my ship's sail adjustable, which includes changing its angle relative to the rest of the ship. In order to do this, I need to rotate the top beam that it's attached to. Since players can walk on said beam, I need to rotate its collider along with the visual represe...
- Fri Nov 22, 2019 7:10 pm
- Forum: Questions and Help
- Topic: Bepu v2 Collision Detection
- Replies: 14
- Views: 21252
Re: Bepu v2 Collision Detection
Is there a way to get the normal of a collision? Something like the red line in the picture. Since the ship body is quite large, simply grabbing the difference between the 2 objects' centers won't work.
- Mon Nov 18, 2019 11:31 pm
- Forum: Questions and Help
- Topic: Bepu v2 Collision Detection
- Replies: 14
- Views: 21252
Re: Bepu v2 Collision Detection
If you want to keep using the BodyProperty type, you could change the reference to an index or some other piece of metadata that allows you to quickly look up the instance in question. Everything I need to do this is already in place since I use dictionaries to track ships, cannonballs, etc. and th...
- Mon Nov 18, 2019 11:00 pm
- Forum: Questions and Help
- Topic: Bepu v2 Collision Detection
- Replies: 14
- Views: 21252
Re: Bepu v2 Collision Detection
I solved the problem and now cannonballs can collide with ships, but when I added the functionality I needed to actually inflict damage on said ship, something went very, very wrong. As soon as a cannonball collides with a ship, Visual Studio opens a page that says "the application is in break ...
- Fri Nov 15, 2019 7:29 pm
- Forum: Questions and Help
- Topic: Bepu v2 Collision Detection
- Replies: 14
- Views: 21252
Re: Bepu v2 Collision Detection
I've finally put everything together so it allows me to run it, however there's an issue. Everything works fine until a cannonball hits a ship, at which point this line: ref CannonballImpact _newImpact = ref cannonballImpacts.AllocateUnsafely(); In the TryAddCannonballImpact method (which is the Try...
- Fri Nov 15, 2019 5:38 am
- Forum: Questions and Help
- Topic: Bepu v2 Collision Detection
- Replies: 14
- Views: 21252
Re: Bepu v2 Collision Detection
There's not a demo showing it, but the callbacks which pass the child indices can be used to do this. For example, you could store a buffer for each body representing the metadata attached to each of the body's children, and index into that data using the childIndex. Based on that metadata you coul...
- Fri Nov 15, 2019 12:45 am
- Forum: Questions and Help
- Topic: Bepu v2 Collision Detection
- Replies: 14
- Views: 21252
Re: Bepu v2 Collision Detection
Also, I just noticed something which I'm wondering whether or not is a mistake. On line 135 of the Tank Demo's TankCallbacks file, there's parentheses around the middle condition of the if statement: if (propertiesA.Projectile || (pair.B.Mobility != CollidableMobility.Static) && Properties[p...
- Fri Nov 15, 2019 12:31 am
- Forum: Questions and Help
- Topic: Bepu v2 Collision Detection
- Replies: 14
- Views: 21252
Re: Bepu v2 Collision Detection
So I'm just in the process of implementing the things I need from the tank demo, but I'm going to need to be able to tell which part of the ship was hit. I want cannonballs to explode anytime they hit anything, however the damage done to the ship needs to be different. For example, I only want canno...
- Mon Nov 11, 2019 8:29 pm
- Forum: Questions and Help
- Topic: Bepu v2 Collision Detection
- Replies: 14
- Views: 21252
Re: Bepu v2 Collision Detection
Alright so I meant to get this stuff sorted out a long time ago, but ended up getting sidetracked by various other things (like rewinding the simulation). I'm just coming back to it, and as I'm reading through some of the comments in the NarrowPhaseCallback functions, it sounds like collision handli...
- Fri Nov 08, 2019 10:15 pm
- Forum: Questions and Help
- Topic: "Rewinding" Simulations
- Replies: 27
- Views: 23268
Re: "Rewinding" Simulations
In the sense that it's not aligned with your actual intent, yup. For example, if your goal is to move along the X axis and so set the ViewDirection to (1,0,0) and the TargetVelocity to (1,0), that would result in the character movement basis 'forward' on a flat plane being (1,0,0), but then the wor...