mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-05 11:29:23 +00:00
Game build 2023r174ex1 test
This commit is contained in:
parent
c169c7336a
commit
f3aa0bc72d
34 changed files with 202 additions and 153 deletions
29
ml_prm/GravityInfluencer.cs
Normal file
29
ml_prm/GravityInfluencer.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using ABI.CCK.Components;
|
||||
using ABI_RC.Systems.Movement;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ml_prm
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
class GravityInfluencer : MonoBehaviour
|
||||
{
|
||||
Rigidbody m_rigidBody = null;
|
||||
PhysicsInfluencer m_physicsInfluencer = null;
|
||||
bool m_activeGravity = true;
|
||||
|
||||
void Start()
|
||||
{
|
||||
m_rigidBody = this.GetComponent<Rigidbody>();
|
||||
m_physicsInfluencer = this.GetComponent<PhysicsInfluencer>();
|
||||
}
|
||||
|
||||
void FixedUpdate()
|
||||
{
|
||||
m_rigidBody.useGravity = false;
|
||||
if(m_activeGravity && ((m_physicsInfluencer == null) || !m_physicsInfluencer.enableInfluence || !m_physicsInfluencer.GetSubmerged()))
|
||||
m_rigidBody.AddForce(BetterBetterCharacterController.Instance.GravityResult.AppliedGravity * m_rigidBody.mass);
|
||||
}
|
||||
|
||||
public void SetActiveGravity(bool p_state) => m_activeGravity = p_state;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue