Minor Code issues

DavidC

Active member
I found both of these while helping with the topic about stopping arrows from sticking in swords, which was also on my to do list. https://www.opsive.com/forum/index.php?threads/arrow-stick-into-characters-sword.5930/#post-29239


Under Destructible.cs the null prevention method is protected, and the non-null prevention method is public (which is called by the first). Seems like their access modifiers should be swapped.
1624560811983.png

Tracing code, this value in Trajectory Object seems to never be set to anything but null. This is then put into the event system for OnImpactEvent for Destructible/Projectile. Variable is GameObject originator

1624560958110.png

There's a "third" problem related to this in the other post (look at my most recent post there). http://www.opsive.com/forum/index.php?threads/arrow-stick-into-characters-sword.5930/post-29246
 
Last edited:
Under Destructible.cs the null prevention method is protected, and the non-null prevention method is public (which is called by the first). Seems like their access modifiers should be swapped.
You're right - I've made that change.

Tracing code, this value in Trajectory Object seems to never be set to anything but null. This is then put into the event system for OnImpactEvent for Destructible/Projectile. Variable is GameObject originator
When the trajectory object is enabled the originator is set to null, but if it is later used for something like an arrow the originator is set correctly. Take a look at line 838 of ShootableWeapon:

Code:
            projectile.Initialize((m_CharacterLocomotion.Velocity - m_CharacterLocomotion.LocomotionVelocity) + rotation * Vector3.forward * m_ProjectileFireVelocityMagnitude * strength, 
                                    Vector3.zero, m_DamageAmount, m_ImpactForce, m_ImpactForceFrames, m_ImpactLayers, m_ImpactStateName, m_ImpactStateDisableTimer, m_SurfaceImpact, m_Character);

So that code looks ok. I will take a look at the other thread.
 
Top