1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-04 02:41:19 +00:00
Commit Graph

18 Commits

Author SHA1 Message Date
jvoisin
3cbf1dc042 First pass with include-what-you-use 2022-10-09 10:39:43 +00:00
clang-format-bot
ddb0522bbf
Apply clang-format to code base 2022-09-22 21:35:26 +03:00
elsid
bd98404890
Initialize PtrHolder::mPtr and positions by its constructor 2022-09-17 01:14:04 +02:00
jvoisin
72a6d1f69f Clean up bullet includes 2022-06-04 20:15:10 +02:00
Frederic Chardon
63bf4bf868 Solve 2 bugs in projectile movement simulation:
- properly initialize mSimulationPosition in the constructor. Unlucky thread scheduling can cause processHits to be called before the first simulation run, causing the projectile to vanish to whatever value the variable happens to contains.
- don't continue moving the projectile after a hit. The position would continue to be updated to some senseless value.
2021-12-29 15:20:44 +01:00
fredzio
ad7a810a62 Unify interface for Actor and Projectile 2021-10-27 22:03:04 +02:00
fredzio
0bce6c09e1 Change projectile behaviour to be like in vanilla wrt. water plane:
- enchanted arrow explode upon hit the water plane
- non enchanted arrow disappear (or more accurately, they hit nothingness)
- enchanted arrow shot underwater explode immediately
- non enchanted arrow disappear immediately

Also, solve a bug that occured previously and could theoritically still happens where we use the last tested collision position for instead of the last registered hit:
Use the hit position as saved inside Projectile::hit() instead of the last position saved inside the callback.
If a projectile collides with several objects (bottom of the sea and water surface for instance), the last collision tested won't necessarily be the impact position as we have no control over the order in which the tests are performed.
2021-09-03 10:24:05 +02:00
fredzio
07fa1803f7 Use btCollisionObject* instead of MWWorld::Ptr inside of Projectile
collision handling and castRay() to avoid calling getPtr(). It is a step forward
removing the mutex inside of PtrHolder.

Do the same for DeepestNotMeContactTestResultCallback. It is used
only for not-ranged combat for now, but do it anyway for parity with all
other callback. This way, once the PtrHolder mutex is gone one will not
have to worry about wether it is safe to use the callback in a specific
context.

To avoid use-after-free with projectile / projectile collision, defer deletion of projectile.
Since instead of storing a copy of target Ptr we have a pointer to its collision object,
we can't delete projectiles until after we finished iterating over the loops.
2021-08-08 15:05:07 +02:00
fredzio
44f822da56 Do not store a btTransform into Projectile class: reduce its size by 112 bytes 2021-07-17 13:11:41 +02:00
jvoisin
1123dc46ee Add a ton of const refs 2021-06-23 23:13:59 +02:00
jvoisin
be371ccd9f An another pass 2021-04-30 20:27:33 +02:00
fredzio
1f4c85520f Use convexSweepTest for projectile movement to solve any
imprecision issue with projectile collision detection.
Simplify the mechanics: manage hits in one spot.
Give magic projectiles a collision shape similar in size to their visible
model.

Rename the 2 convex result callback to clearly state their purpose.
2021-01-21 20:36:33 +01:00
fredzio
d015f17a6c Make all physics object manage their own resources
Use smart pointer for heightfields and their members.
Move collision object addition inside of Object's ctor, as for Actors and HeightFields
2021-01-10 14:56:35 +01:00
fredzio
b39437dfb6 Don't allow projectiles to stand still when they hit an ally.
When an NPC fire a projectile, it should affect only its targeted actor.
To this end, after a hit is detected the target is checked against the
list of AI targets and reactivated if necessary.
Problem occurs when the hit occurs as a result of a friendly actor going
into the projectile (detected in ClosestNotMeConvexResultCallback):
while the projectile is inside the friend's collision box, it is
deactivated, just to be immediately reactivated. Effectively, the
projectile does nothing until the actor moves out.

Add a check inside the ClosestNotMeConvexResultCallback before declaring
a hit.
Since the necessary data is not safely accessible from the async thread,
maintain a copy inside the Projectile class.
2020-12-14 22:23:01 +01:00
fredzio
4fbe1ed12c Ignore caster collision shape. Sometimes the magic bolt get launched
inside too near its caster.
2020-12-08 09:06:34 +01:00
fredzio
7e85235220 Projectile to projectile collision 2020-12-08 09:06:34 +01:00
fredzio
66fe3b0d38 Modify projectile collision to work with async physics 2020-12-08 09:06:33 +01:00
Andrei Kortunov
dc7b48e92e Generate physics collisions for projectiles (bug #3372)
Remove redundant now mHit field
2020-12-08 09:05:38 +01:00