RigsOfRods / rigs-of-rods

Main development repository for Rigs of Rods soft-body physics simulator
https://www.rigsofrods.org
GNU General Public License v3.0
1.01k stars 175 forks source link

Ηeadlights: ignore already attached objects #2946

Closed tritonas00 closed 1 year ago

tritonas00 commented 1 year ago

https://forum.rigsofrods.org/resources/coca-cola-t600-dry-van-trailer.86/

Load trailer, press N to open lights Load the truck, press L to lock with the trailer and press N, it tries to re attach trailer's flares (because main vehicle lights trigger trailer lights also) so crash:

InvalidParametersException: Object already attached to a SceneNode or a Bone in SceneNode::attachObject at /home/babis/Downloads/ror-dependencies/Source/ogre/OgreMain/src/OgreSceneNode.cpp (line 105)
tritonas00 commented 1 year ago

It can be spammy though, especially with that amount of flares

kk

ohlidalp commented 1 year ago

It can be spammy though, especially with that amount of flares

in that case just check m_headlights_on and don't call toggleLights() if already on. Throwing that many exceptions isn't good for FPS.

EDIT: apparently we have something broken somewhere because the state of m_headlights_on is desynchronized with the actual OGRE flares.

ohlidalp commented 1 year ago

Purpose: to fix a crash (unhandled exception). Apparently there's a bug in synchronizing light states between player vehicle and attached vehicles (trailers etc...).

Estimate: To fix correctly, wait for #2937 to be done - it completely overhauls the light state system, and fixes this in the process. For a dirty workaround suggested by Tritonas, 1 man day should be enough.

tritonas00 commented 1 year ago

https://github.com/RigsOfRods/rigs-of-rods/pull/2937