Search found 79 matches

by tomweiland
Tue Dec 10, 2019 6:54 pm
Forum: Questions and Help
Topic: Rotating parts of compound body
Replies: 1
Views: 13

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...
by tomweiland
Fri Nov 22, 2019 7:10 pm
Forum: Questions and Help
Topic: Bepu v2 Collision Detection
Replies: 14
Views: 2300

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.
CollisionNormal.png
CollisionNormal.png (4.43 KiB) Viewed 860 times
by tomweiland
Mon Nov 18, 2019 11:31 pm
Forum: Questions and Help
Topic: Bepu v2 Collision Detection
Replies: 14
Views: 2300

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...
by tomweiland
Mon Nov 18, 2019 11:00 pm
Forum: Questions and Help
Topic: Bepu v2 Collision Detection
Replies: 14
Views: 2300

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 mode"...
by tomweiland
Fri Nov 15, 2019 7:29 pm
Forum: Questions and Help
Topic: Bepu v2 Collision Detection
Replies: 14
Views: 2300

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...
by tomweiland
Fri Nov 15, 2019 5:38 am
Forum: Questions and Help
Topic: Bepu v2 Collision Detection
Replies: 14
Views: 2300

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...
by tomweiland
Fri Nov 15, 2019 12:45 am
Forum: Questions and Help
Topic: Bepu v2 Collision Detection
Replies: 14
Views: 2300

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[pair.B.Ha...
by tomweiland
Fri Nov 15, 2019 12:31 am
Forum: Questions and Help
Topic: Bepu v2 Collision Detection
Replies: 14
Views: 2300

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...
by tomweiland
Mon Nov 11, 2019 8:29 pm
Forum: Questions and Help
Topic: Bepu v2 Collision Detection
Replies: 14
Views: 2300

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...
by tomweiland
Fri Nov 08, 2019 10:15 pm
Forum: Questions and Help
Topic: "Rewinding" Simulations
Replies: 27
Views: 1249

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...
by tomweiland
Fri Nov 08, 2019 9:49 pm
Forum: Questions and Help
Topic: "Rewinding" Simulations
Replies: 27
Views: 1249

Re: "Rewinding" Simulations

So then by "a TargetVelocity that is accidentally cancelling out the ViewDirection" you just mean if I'm setting a TargetVelocity manually, it may not align with the ViewDirection that I've set? That would mean it's on my end again...so probably not an easy fix :cry:
by tomweiland
Fri Nov 08, 2019 9:30 pm
Forum: Questions and Help
Topic: "Rewinding" Simulations
Replies: 27
Views: 1249

Re: "Rewinding" Simulations

So it sounds like there's an inconsistency of some sort in how the ViewDirection and TargetVelocity are being set- a constant ViewDirection, or a TargetVelocity that is accidentally cancelling out the ViewDirection, or something along those lines. So does the order in which I set the two affect any...
by tomweiland
Fri Nov 08, 2019 7:28 pm
Forum: Questions and Help
Topic: "Rewinding" Simulations
Replies: 27
Views: 1249

Re: "Rewinding" Simulations

Alright so I've added TargetVelocity and TryJump to the states, and the stuttering seems to be gone, however the player now moves along the global axes, instead of his local ones (pressing the forward key causes the player to move in the same direction regardless of which way he is facing). This was...
by tomweiland
Fri Nov 08, 2019 5:32 am
Forum: Questions and Help
Topic: "Rewinding" Simulations
Replies: 27
Views: 1249

Re: "Rewinding" Simulations

Norbo wrote:
Fri Nov 08, 2019 1:53 am
Is the character state being rewound and replayed properly too? The critical ones would be ViewDirection, TargetVelocity, and TryJump. Other than that, nothing springs to mind.
ViewDirection, yes. TargetVelocity and TryJump, nope. I'll take add that tomorrow and see if it fixes it.
by tomweiland
Fri Nov 08, 2019 1:12 am
Forum: Questions and Help
Topic: "Rewinding" Simulations
Replies: 27
Views: 1249

Re: "Rewinding" Simulations

Good luck! :D Thanks! I actually managed to figure it out. It was of course something really stupid on my part, namely the state storing a reference to some positions instead of a copy, which ended up screwing up my buoyancy calculations. Everything seems to be working great now, except for player ...