1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 22:49:55 +00:00
Commit graph

278 commits

Author SHA1 Message Date
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
Alexei Dobrohotov
15291f15d3 Make actor collision box components a struct 2020-12-11 20:07:59 +03: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
fredzio
7843dad35d Don't let the actor "nowhere" after a teleport but move them in their
place.
This solve the problem where after loading, an empty frame was rendered
because the player is "nowhere".
2020-12-05 01:09:43 +01:00
fredzio
5a4872393a Rework actor position reset. While solving the issue with invalid
position being used under heavy load, I introduced a regression that
prevented the position to be updated in case of teleport.
Move the logic in its own function and decide in PhysicsSystem whether a
reset is needed.
2020-12-03 12:57:57 +01:00
fredzio
ea2ba27084 Move the moment when the actor origin is saved before simulation so to
be sure the simulation is over. Otherwise, if the simulation is too slow
the position is wrong, and the actors would jump back and forth between
old and new position instead of actually moving.
2020-11-28 21:36:45 +01:00
Frederic Chardon
9aba55a21a Add the async physics worker to the profiler overlay. 2020-11-20 21:17:47 +01:00
AnyOldName3
06d1e70aac Make Bullet DebugDrawer's default state match the physics system 2020-11-18 15:34:21 +00:00
Frederic Chardon
bb5213670c Use bigger hammer to set Actor's position after teleporting. Otherwise traceDown() would use old collision object transform and gives incorrect results, making the Actor "fall" in the new position. 2020-11-16 11:35:50 +01:00
fredzio
d64ed6cf53 Get rid of the StandingActorsMap. Just embed the necessary info into
Actor class.
2020-11-15 01:58:21 +01:00
fredzio
e5fa457fe7 Properly account for interleaved move of actors.
Before this change, if an actor position was changed while the physics
simulation was running, the simulation result would be discarded. It is
fine in case of one off event such as teleport, but in the case of
scripts making use of this functionality to make lifts or conveyor (such
as Sotha Sil Expanded mod) it broke actor movement.

To alleviate this issue, at the end of the simulation, the position of the Actor
in the world is compared to the position it had at the beginning of the
simulation. A difference indicate a force move occured. In this case,
the Actor mPosition and mPreviousPosition are translated by the difference of position.

Since the Actor position will be really set while the next simulation runs, we
save it in the mNextPosition field.
2020-11-14 20:39:16 +01:00
fredzio
18e38d8810 Do not block a door when it turns away. 2020-11-01 23:01:18 +01:00
psi29a
ba3aad31c1 Merge branch 'hitdebug' into 'master'
Visualize hits in the debug overlay

See merge request OpenMW/openmw!379
2020-11-01 10:20:14 +00:00
Andrei Kortunov
64ba81ecf2 Fix some issues, found by CoverityScan 2020-10-28 18:02:31 +04:00
Frederic Chardon
574ccbf7bd Visualize hand to hand hits 2020-10-26 13:48:15 +01:00
fredzio
435b2e37f8 Allow to display collision points in the debug viewer 2020-10-26 13:42:46 +01:00
Bret Curtis
5a824d0333 components/compiler cleanup; also cleaned up related cascading warnings; fixed up final/override issues 2020-10-22 23:57:53 +02:00
fredzio
a19db73eca Fix bad rebase 2020-10-22 09:24:56 +02:00
fredzio
1357bba0a0 Use some C++17 where it makes the code more readable
Also replace boost::optional
2020-10-22 07:15:16 +02:00
fredzio
4fc5b6f6f4 Sort headers 2020-10-22 07:15:16 +02:00
fredzio
212b293803 Use same parameter name in definition and declaration 2020-10-22 07:15:16 +02:00
fredzio
2916a9462e Fix standing actors logic:
it is updated in the solver only if the actor is standing on
"something". The ground is not "something", so in case the actor goes
from standing on an object to the standing on the ground, this change was not taken
into account.
Clear the value before the simulation to solve this problem.
2020-10-21 21:32:06 +02:00
fredzio
a036183248 Use a much simpler and assert-free check for Bullet multithreading support 2020-10-19 21:31:52 +02:00
Bret Curtis
8050882baf
Merge pull request #3015 from akortunov/overrides
Mark overrided methods as overrides
2020-10-17 13:32:08 +02:00
Andrei Kortunov
8ca3c3b123 Mark overrided methods by override keyword 2020-10-16 22:18:54 +04:00
fredzio
978af12c2d Restore fall damage 2020-10-16 19:30:03 +02:00
fredzio
3c2504b442 Process movement queue in one or several background threads
Before movement calculation, the main thread prepare a
vector of ActorFrameData, which contains all data necessary to perform
the simulation, and feed it to the solver. At the same time it fetches
the result from the previous background simulation, which in turn is
used by the game mechanics.
Other functions of the physics system (weapon hit for instance)
interrupt the background simulation, with some exceptions described
below.

The number of threads is controlled by the numeric setting

[Physics]
async num threads

In case 'async num threads' > 1 and Bullet doesn't support multiple threads,
1 async thread will be used. 0 means synchronous solver.
Additional settings (will be silently switched off if async num threads = 0)

[Physics]
defer aabb update

Update AABBs of actors and objects in the background thread(s). It is not an especially
costly operation, but it needs exclusive access to the collision world, which blocks
other operations. Since AABB needs to be updated for collision detection, one can queue
them to defer update before start of the movement solver. Extensive tests on as much
as one installation (mine) show no drawback having that switched on.

[Physics]
lineofsight keep inactive cache

Control for how long (how many frames) the line of sight (LOS) request will be kept updated.
When a request for LOS is made for the first time, the background threads are stopped to
service it. From now on, the LOS will be refreshed preemptively as part of the background
routine until it is not required for lineofsight keep inactive cache frames. This mean
that subsequent request will not interrupt the background computation.
2020-10-15 06:41:35 +02:00
fredzio
91b3926a49 We need to update the collision world after each step.
Change order of traversal simulation step to make it rare enough to be parallelizable

Before:
for actor in actors:
    repeat numstep:
        solve(actor)
After:
repeat numstep:
    for actor in actors:
        solve(actor)

Introduce struct ActorFrameData to pack all data that is necessary for
the solver
2020-10-15 06:41:22 +02:00
fredzio
d76cc5d0a9 Make the Object class manage its collision object and position. 2020-10-15 06:41:16 +02:00
fredzio
4ef36973fb Make the Actor class manage its collision object and position. 2020-10-15 06:41:08 +02:00
fredzio
82da2045a9 Non functionnal changes in preparation for async physics feature 2020-10-15 06:41:03 +02:00
Alexei Dobrohotov
ec825b2510 Fix RayCastingResult warning 2020-10-08 22:44:46 +03:00
AnyOldName3
9e78f3d936 Skip raycasting for zero-length rays
Rays with no length can't intersect anything. This also prevents an
assertion triggering with Bullet built in Debug mode.
2020-10-03 02:19:38 +01:00
Andrei Kortunov
f9e667dd8c Fix MSVC warnings 2020-08-26 12:34:27 +04:00
Petr Mikheev
0de6650add Add RayCastingInterface 2020-08-06 22:03:33 +02:00
Petr Mikheev
ed3426cf2f Move third person camera collision check from World::updatePlayer() to Camera::updatePosition() 2020-08-06 00:43:33 +02:00
Andrei Kortunov
4a5fce8ca5 Use more C++11 in the physics code 2020-06-26 14:22:00 +04:00
bzzt lost a hitlab login
89ec6cfea2 tooltips labels
Signed-off-by: Bret Curtis <psi29a@gmail.com>
2020-06-13 00:22:28 +02:00
Capostrophic
577786f110 Don't disable player's collision shape in TCL (#5435) 2020-05-30 00:55:17 +03:00
elsid
69df6098e5
Report frame number, number of actors and objects to stats 2020-05-22 17:39:18 +02:00
elsid
2d7c3bae61
Support bullet with double precision 2020-05-13 19:24:28 +02:00
Capostrophic
5e2e5b7aa9 Fix btCollisionObjectWrapper forward declaration 2020-03-31 18:31:46 +03:00
Capostrophic
4f08f6e09b Separate ClosestNotMeConvexResultCallback 2020-03-31 00:38:34 +03:00
Capostrophic
19010ec045 Separate MovementSolver 2020-03-31 00:38:34 +03:00
Capostrophic
ca6cce0c7e Separate Stepper 2020-03-31 00:38:34 +03:00
Capostrophic
5d625c12dc Separate ContactTestResultCallback 2020-03-31 00:38:34 +03:00
Capostrophic
c94cd775bf Separate ClosestNotMeRayResultCallback 2020-03-31 00:38:34 +03:00
Capostrophic
ce588fb39c Separate DeepestNotMeContactTestResultCallback 2020-03-31 00:38:34 +03:00
Capostrophic
1629791885 Port wareya's actor tracer consistency fixes 2020-03-30 21:23:41 +03:00
elsid
4a0c056489
Do not wander to occupied area by other actor 2020-02-10 22:29:54 +01:00
Capostrophic
4e54ed86b3 Fix jumping mechanics framerate dependency (bug #4991) 2019-07-29 15:45:57 +03:00
Andrei Kortunov
6832a2fa9a Remove BOM from CPP files (allows to build OpenMW with LCC on Elbrus) 2019-05-21 19:22:34 +04:00
Andrei Kortunov
6a01e4cd8a Fix arguments order for raytracing in the getHitContact() (bug #4990) 2019-04-22 20:46:38 +04:00
Andrei Kortunov
d23a0ce2ae Use C++11-style loops in the game world instead of iterators 2019-03-07 12:39:57 +04:00
elsid
43b39e8418
Use not scaled player half extents as default to find path 2019-03-04 22:59:38 +03:00
Bret Curtis
14c93b3df0 Revert "Merge pull request #2204 from elsid/fix_navigator_update"
This reverts commit 26fb0e7a0f, reversing
changes made to 42b2391303.
2019-03-04 11:06:15 +01:00
elsid
c066ee9dc5
Use not scaled player half extents as default to find path 2019-03-03 16:21:12 +03:00
Grigory Latyshev
3872d7476b Move makeOsgVec3f() to settingsutils.hpp
Remove all other makeOsgVec3f() implementations
2019-02-28 20:03:42 +00:00
Andrei Kortunov
3032b177a1 Remove redundant includes 2019-02-23 08:02:12 +04:00
Capostrophic
a584aa25ab Don't re-enable collision object for dead actors 2019-02-04 22:13:30 +03:00
Capostrophic
403db9afe3 Don't reset player jumping flag unnecessarily (bug #4775) 2019-01-07 16:08:26 +03:00
Capostrophic
0bbcc0e787 Avoid falling height reset if onGround state didn't change (bug #4411) 2018-12-23 13:39:35 +03:00
Andrei Kortunov
a53333c3d5 Native animated containers support (feature #4730) 2018-12-13 23:11:16 +04:00
elsid
49d81241db Merge branch 'master' into pathfinder_detour 2018-10-28 17:08:09 +03:00
Marc Zinnschlag
9dd0d641bc Merged pull request #1931 2018-10-28 11:02:33 +01:00
Andrei Kortunov
e7de6b974a Optimize actors processing
1. Do not update physics and animations for actors outside processing range (bug #4647)
2. Do not render such actors
3. Add transparency to actors near processing border, so they will not pop up suddenly
2018-10-25 22:52:59 +04:00
Andrei Kortunov
61e6e359c4 Allow creatures to use the autogenerated collision box (feature #2787) 2018-10-22 15:48:23 +04:00
Andrei Kortunov
13bd81f896 Try to use collisions from basic actor model if an animated one has no collisions (feature #4682) 2018-10-16 22:28:19 +04:00
elsid
fa23b590a4
Add unwalkable areas to NavMesh 2018-10-13 22:16:32 +03:00
elsid
144e1a063b
Support animated objects 2018-10-13 22:16:30 +03:00
elsid
fafba8ea0c
Use recastnavigation to find path 2018-10-13 22:16:25 +03:00
elsid
c866fdff86
Move physics object, heightfield, ptrholder into separate files 2018-10-13 22:16:24 +03:00
Andrei Kortunov
e06f0b797a Replace all NULLs to nullptr 2018-10-09 10:21:12 +04:00
Andrei Kortunov
70ed8fd1a9 Use constants instead of widely used magic numbers (task #4645) 2018-09-17 19:22:50 +04:00
Andrei Kortunov
ae1c054635 Make GetPCJumping return true only when jumping (bug #4641) 2018-09-16 11:58:01 +04:00
Capostrophic
7ef6fa9f61 Remove deprecated GMST get* functions 2018-08-29 18:38:12 +03:00
Andrei Kortunov
c6dcfd1fce Do not apply scale twice for animated collision nodes (bug #4607) 2018-08-25 17:26:17 +04:00
Andrei Kortunov
5a4d0cec3a Use new logging system for game itself 2018-08-14 23:05:43 +04:00
Andrei Kortunov
bc82dbbd1b Do not try to find missing animated collision shape again and again 2018-07-28 16:49:00 +04:00
Bret Curtis
61c969e970
Merge branch 'master' into hitboxfix 2018-06-08 18:36:44 +02:00
Andrei Kortunov
bde1d07d4e Use hitboxes and focused object for touch spells (bug #3374) 2018-06-07 16:12:27 +04:00
Andrei Kortunov
f5dc9f0162 Use hitbox cone only as fallback 2018-06-07 16:12:27 +04:00
scrawl
99ffaafe30
Revert "Merge pull request #1701 from akortunov/standfix"
This reverts commit da47fc79f5, reversing
changes made to 7324bd368f.
2018-05-26 11:35:48 +00:00
Andrei Kortunov
f8655d2425 Use actor's physics position as a ray origin in tracer 2018-05-14 20:38:53 +04:00
Capostrophic
e32f38b939 Allow jumping when you're stuck on a slope (fixes #4221) 2018-05-13 17:19:33 +03:00
Andrei Kortunov
3636cf2015 Do not apply queue movement for standing actors 2018-05-05 22:41:26 +04:00
elsid
26df0e6ebd Remove duplicated include 2018-03-13 21:28:38 +03:00
Bret Curtis
c3c3fbc68e overriden -> overridden 2018-01-02 11:42:08 +01:00
Miloslav Číž
03401bb5df remove redundant condition 2017-10-27 20:19:20 +02:00
scrawl
03554b2f4b Fix some style issues flagged by cppcheck 2017-10-15 17:06:58 +02:00
scrawl
64d02f577e Fix missing null check 2017-10-15 17:06:58 +02:00
Andrei Kortunov
62177ebb30 Move physics framerate from setting to environment variable 2017-09-26 21:23:15 +04:00
Andrei Kortunov
6062cd4b9c Make physics framerate configurable 2017-09-26 17:15:58 +04:00
scrawl
fcb815f2c7 Move fall height reset into PhysicsSystem (Fixes #4049)
To avoid using onGround before it's actually set.
2017-09-17 23:06:51 +00:00
scrawl
a8005c33d9 Revert unintended change to mOnGround variable that was somehow introduced with 38a2de3c51 2017-08-31 21:58:12 +00:00
Ewan Higgs
38a2de3c51 convert std::autor_ptr to std::unique_ptr, originally by Ewan Higgs and updated by Bret Curtis 2017-06-09 16:49:25 +02:00
Allofich
ff3e307059 Pass parameters by const reference 2017-04-20 23:47:03 +09:00