From cc090bdf47a843c77225dd0bb96fc20ebfcea2c0 Mon Sep 17 00:00:00 2001 From: Josef Date: Fri, 31 Oct 2025 13:09:03 +0100 Subject: [PATCH] DomeFox Updates --- Runtime/Actions/ActionSequence.cs | 4 +- Runtime/Actions/Node3D/PlayParticles.cs | 1 - Runtime/Actions/RemoveNode.cs | 9 +++ Runtime/Actions/Visual/TweenParticles.cs | 11 +-- .../Shake/Presets/Mini Poke - Shake.tres | 14 ---- Runtime/Audio/AudioManager/AudioFlag.cs | 2 +- .../Cameras/Effects/Presets/Earth Quake.tres | 12 +--- .../Cameras/Effects/Presets/ScreenShake.tres | 16 +---- Runtime/Godot/Extensions/Node3DExtensions.cs | 32 +++++++++ Runtime/Godot/Extensions/NodeExtensions.cs | 32 +++++++++ .../Godot/Extensions/NodeExtensions.cs.uid | 1 + Runtime/Godot/Nodes.cs | 4 +- Runtime/Interactions/Collidable.cs | 22 ++++++ Runtime/Interactions/Collider.cs | 71 +++++++++++++++---- Runtime/Interactions/CollisionFlag.cs | 2 +- Runtime/Interactions/MultiRayCaster.cs | 14 ++-- Runtime/Math/Geometry/Plane3.cs | 7 ++ Runtime/Physics/CollisionData.cs | 4 +- Runtime/Physics/Projectile.cs | 59 +++++++++++++++ Runtime/Physics/Projectile.cs.uid | 1 + .../SetTextureAttributeChannel.cs | 4 +- Runtime/Sensors/SensorManager.cs | 23 +++++- Runtime/Sensors/SensorManagerSetup.cs | 9 ++- Runtime/Time/TimeLine.cs | 3 + Runtime/Time/TimeLineManager.cs | 5 ++ Runtime/Time/TimeLineRunner.cs | 2 +- Runtime/Time/TimeLines/RealTime.tres | 3 +- Runtime/Time/TimeLines/UITime.tres | 6 +- Runtime/UI/Nodes/UIInputInfo.cs | 12 ++-- Runtime/UI/UI-Settings-Default.tres | 2 +- 30 files changed, 298 insertions(+), 89 deletions(-) create mode 100644 Runtime/Godot/Extensions/NodeExtensions.cs create mode 100644 Runtime/Godot/Extensions/NodeExtensions.cs.uid create mode 100644 Runtime/Physics/Projectile.cs create mode 100644 Runtime/Physics/Projectile.cs.uid diff --git a/Runtime/Actions/ActionSequence.cs b/Runtime/Actions/ActionSequence.cs index f8cbe6b..ede7a37 100644 --- a/Runtime/Actions/ActionSequence.cs +++ b/Runtime/Actions/ActionSequence.cs @@ -161,7 +161,7 @@ namespace Rokojori return; } - // RJLog.Log( "Triggering Action", actions[ i ].Name ); + // RJLog.Log( _runID, "Triggering Actions Before", i, actions[ i ].Name, HierarchyName.Of( action ) ); Action.Trigger( actions[ i ] ); } @@ -210,6 +210,8 @@ namespace Rokojori { return; } + + // this.LogInfo( "Running" ); var run = new ActionSequenceRunner(); run.sequence = this; diff --git a/Runtime/Actions/Node3D/PlayParticles.cs b/Runtime/Actions/Node3D/PlayParticles.cs index 465bab2..e867b63 100644 --- a/Runtime/Actions/Node3D/PlayParticles.cs +++ b/Runtime/Actions/Node3D/PlayParticles.cs @@ -68,7 +68,6 @@ namespace Rokojori } ); p.Restart(); - } public int IndexOf( GpuParticles3D p ) diff --git a/Runtime/Actions/RemoveNode.cs b/Runtime/Actions/RemoveNode.cs index c68271a..79ed1f4 100644 --- a/Runtime/Actions/RemoveNode.cs +++ b/Runtime/Actions/RemoveNode.cs @@ -13,6 +13,9 @@ namespace Rokojori [Export] public bool queue = true; + [Export] + public bool disableAllNodes = true; + protected override void _OnTrigger() { @@ -37,6 +40,12 @@ namespace Rokojori return; } + if ( disableAllNodes ) + { + target.ForEach( n => NodeState.Disable( n ) ); + NodeState.Disable( target ); + } + target.SelfDestroy( queue ); } } diff --git a/Runtime/Actions/Visual/TweenParticles.cs b/Runtime/Actions/Visual/TweenParticles.cs index c73029c..5697c82 100644 --- a/Runtime/Actions/Visual/TweenParticles.cs +++ b/Runtime/Actions/Visual/TweenParticles.cs @@ -24,10 +24,10 @@ namespace Rokojori protected override void _OnTrigger() { - if ( Engine.IsEditorHint() ) - { - return; - } + // if ( Engine.IsEditorHint() ) + // { + // return; + // } if ( particles3D == null ) { @@ -73,7 +73,8 @@ namespace Rokojori { DispatchEnd( sequenceID ); } - } + }, + this ); } diff --git a/Runtime/Animation/Shake/Presets/Mini Poke - Shake.tres b/Runtime/Animation/Shake/Presets/Mini Poke - Shake.tres index 8e35a29..e39aff1 100644 --- a/Runtime/Animation/Shake/Presets/Mini Poke - Shake.tres +++ b/Runtime/Animation/Shake/Presets/Mini Poke - Shake.tres @@ -10,13 +10,7 @@ point_count = 3 [sub_resource type="Resource" id="Resource_jwnpm"] script = ExtResource("2_g6huw") -duration = 1.0 -durationRandomRange = 0.0 -delay = 0.0 -delayRandomRange = 0.0 curve = SubResource("Curve_j2uji") -scaleY = 1.0 -scaleRandomRange = 0.0 [sub_resource type="Curve" id="Curve_c1l7g"] _limits = [-1.0, 1.0, 0.0, 1.0] @@ -25,25 +19,17 @@ point_count = 2 [sub_resource type="Resource" id="Resource_qub8t"] script = ExtResource("2_g6huw") -duration = 1.0 -durationRandomRange = 0.0 -delay = 0.0 -delayRandomRange = 0.0 curve = SubResource("Curve_c1l7g") scaleY = 30.0 -scaleRandomRange = 0.0 [resource] script = ExtResource("1_gbi52") shakeAmountCurve = SubResource("Resource_jwnpm") shakeChangeFPSCurve = SubResource("Resource_qub8t") timeline = ExtResource("3_pgufg") -smooth = true smoothingStrength = 0.477 positionShake = Vector3(0.075, 0, 0.075) globalPosition = false -repeatAndFlipFirstPosition = true rotationShake = Vector3(0.5, 0.5, 10) globalRotation = false scaleShake = Vector3(0.1, 0.1, 0.1) -scaleShakeIsRelative = true diff --git a/Runtime/Audio/AudioManager/AudioFlag.cs b/Runtime/Audio/AudioManager/AudioFlag.cs index 9b59aee..e572067 100644 --- a/Runtime/Audio/AudioManager/AudioFlag.cs +++ b/Runtime/Audio/AudioManager/AudioFlag.cs @@ -4,7 +4,7 @@ using System.Text; namespace Rokojori { - [GlobalClass,Tool, Icon("res://addons/rokojori_action_library/Icons/SelecorFlag.svg") ] + [GlobalClass,Tool] public partial class AudioFlag:SelectorFlag { diff --git a/Runtime/Cameras/Effects/Presets/Earth Quake.tres b/Runtime/Cameras/Effects/Presets/Earth Quake.tres index a076b92..6617c24 100644 --- a/Runtime/Cameras/Effects/Presets/Earth Quake.tres +++ b/Runtime/Cameras/Effects/Presets/Earth Quake.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="CameraEffect" load_steps=8 format=3 uid="uid://ds6sptirfbytc"] -[ext_resource type="Script" uid="uid://bw7kbgl2vbeoh" path="res://addons/rokojori_action_library/Runtime/VirtualCameras/Effects/CameraEffectTargetAnimationCurve.cs" id="1_m7t4k"] -[ext_resource type="Script" uid="uid://bmcpy4cqv1lmr" path="res://addons/rokojori_action_library/Runtime/VirtualCameras/Effects/CameraEffect.cs" id="2_ahqbp"] +[ext_resource type="Script" uid="uid://bw7kbgl2vbeoh" path="res://addons/rokojori_action_library/Runtime/Cameras/Effects/CameraEffectTargetAnimationCurve.cs" id="1_m7t4k"] +[ext_resource type="Script" uid="uid://bmcpy4cqv1lmr" path="res://addons/rokojori_action_library/Runtime/Cameras/Effects/CameraEffect.cs" id="2_ahqbp"] [ext_resource type="Resource" uid="uid://h6oi6vkj4c2m" path="res://addons/rokojori_action_library/Runtime/Time/TimeLines/RealTime.tres" id="3_iffro"] [sub_resource type="Curve" id="Curve_62jxv"] @@ -11,12 +11,8 @@ point_count = 8 [sub_resource type="Resource" id="Resource_esvga"] script = ExtResource("1_m7t4k") -target = 0 flipScaleYRandomly = true duration = 0.5 -durationRandomRange = 0.0 -delay = 0.0 -delayRandomRange = 0.0 curve = SubResource("Curve_62jxv") scaleY = 0.05 scaleRandomRange = 0.1 @@ -29,11 +25,7 @@ point_count = 9 [sub_resource type="Resource" id="Resource_s8na2"] script = ExtResource("1_m7t4k") target = 1 -flipScaleYRandomly = false duration = 0.5 -durationRandomRange = 0.0 -delay = 0.0 -delayRandomRange = 0.0 curve = SubResource("Curve_h7nko") scaleY = 0.05 scaleRandomRange = 0.1 diff --git a/Runtime/Cameras/Effects/Presets/ScreenShake.tres b/Runtime/Cameras/Effects/Presets/ScreenShake.tres index 5dda585..962cd43 100644 --- a/Runtime/Cameras/Effects/Presets/ScreenShake.tres +++ b/Runtime/Cameras/Effects/Presets/ScreenShake.tres @@ -1,7 +1,7 @@ [gd_resource type="Resource" script_class="CameraEffect" load_steps=10 format=3 uid="uid://uyuplc6hm25j"] -[ext_resource type="Script" uid="uid://bmcpy4cqv1lmr" path="res://addons/rokojori_action_library/Runtime/VirtualCameras/Effects/CameraEffect.cs" id="1_5l6xm"] -[ext_resource type="Script" uid="uid://bw7kbgl2vbeoh" path="res://addons/rokojori_action_library/Runtime/VirtualCameras/Effects/CameraEffectTargetAnimationCurve.cs" id="1_x21rf"] +[ext_resource type="Script" uid="uid://bmcpy4cqv1lmr" path="res://addons/rokojori_action_library/Runtime/Cameras/Effects/CameraEffect.cs" id="1_5l6xm"] +[ext_resource type="Script" uid="uid://bw7kbgl2vbeoh" path="res://addons/rokojori_action_library/Runtime/Cameras/Effects/CameraEffectTargetAnimationCurve.cs" id="1_x21rf"] [ext_resource type="Resource" uid="uid://ch5nsa6yafs5l" path="res://addons/rokojori_action_library/Runtime/Time/TimeLines/GameTime.tres" id="3_lfgu3"] [sub_resource type="Curve" id="Curve_62jxv"] @@ -11,12 +11,8 @@ point_count = 5 [sub_resource type="Resource" id="Resource_esvga"] script = ExtResource("1_x21rf") -target = 0 flipScaleYRandomly = true duration = 0.2 -durationRandomRange = 0.0 -delay = 0.0 -delayRandomRange = 0.0 curve = SubResource("Curve_62jxv") scaleY = 0.1 scaleRandomRange = 0.2 @@ -29,11 +25,7 @@ point_count = 6 [sub_resource type="Resource" id="Resource_s8na2"] script = ExtResource("1_x21rf") target = 1 -flipScaleYRandomly = false duration = 0.2 -durationRandomRange = 0.0 -delay = 0.0 -delayRandomRange = 0.0 curve = SubResource("Curve_h7nko") scaleY = 0.1 scaleRandomRange = 0.2 @@ -48,12 +40,8 @@ script = ExtResource("1_x21rf") target = 6 flipScaleYRandomly = true duration = 0.3 -durationRandomRange = 0.0 -delay = 0.0 -delayRandomRange = 0.0 curve = SubResource("Curve_opp1p") scaleY = 10.0 -scaleRandomRange = 0.0 [resource] script = ExtResource("1_5l6xm") diff --git a/Runtime/Godot/Extensions/Node3DExtensions.cs b/Runtime/Godot/Extensions/Node3DExtensions.cs index e613692..018020b 100644 --- a/Runtime/Godot/Extensions/Node3DExtensions.cs +++ b/Runtime/Godot/Extensions/Node3DExtensions.cs @@ -39,6 +39,11 @@ namespace Rokojori return self.DirectionTowards( other ).Length(); } + public static float DistanceTo( this Node3D self, Vector3 position ) + { + return self.DirectionTowards( position ).Length(); + } + public static Vector3 DirectionTowards( this Node3D self, Node3D other ) { return ( other.GlobalPosition - self.GlobalPosition ); @@ -190,6 +195,33 @@ namespace Rokojori node.GlobalPosition = gp; } + public static void SetScaleX( this Node3D node, float x ) + { + var gp = node.Scale; + + gp.X = x; + + node.Scale = gp; + } + + public static void SetScaleY( this Node3D node, float y ) + { + var gp = node.Scale; + + gp.Y = y; + + node.Scale = gp; + } + + public static void SetScaleZ( this Node3D node, float z ) + { + var gp = node.Scale; + + gp.Z = z; + + node.Scale = gp; + } + public static void SetLocalX( this Node3D node, float x ) { var gp = node.Position; diff --git a/Runtime/Godot/Extensions/NodeExtensions.cs b/Runtime/Godot/Extensions/NodeExtensions.cs new file mode 100644 index 0000000..470a79d --- /dev/null +++ b/Runtime/Godot/Extensions/NodeExtensions.cs @@ -0,0 +1,32 @@ +using Godot; + +using System.Collections.Generic; +using System; +using System.Threading.Tasks; +using System.Reflection; +using Microsoft.VisualBasic; + +namespace Rokojori +{ + public static class NodeExtensions + { + public static T GetNextSiblingOrChild( this Node node ) where T:Node + { + var index = node.GetIndex(); + var p = node.GetParent(); + + for ( int i = index + 1; i < p.GetChildCount(); i++ ) + { + var child = p.GetChild( i ); + + if ( child != null && child is T t ) + { + return t; + } + } + + return Nodes.GetAnyChild( node ); + } + + } +} diff --git a/Runtime/Godot/Extensions/NodeExtensions.cs.uid b/Runtime/Godot/Extensions/NodeExtensions.cs.uid new file mode 100644 index 0000000..f72d32f --- /dev/null +++ b/Runtime/Godot/Extensions/NodeExtensions.cs.uid @@ -0,0 +1 @@ +uid://cop83tt1k1hs8 diff --git a/Runtime/Godot/Nodes.cs b/Runtime/Godot/Nodes.cs index 511a907..ae1d8b2 100644 --- a/Runtime/Godot/Nodes.cs +++ b/Runtime/Godot/Nodes.cs @@ -21,6 +21,8 @@ namespace Rokojori return GetAnyChild( node ); } + + public static T GetSelfOrChildOf( this Node node ) where T:Node { if ( node is T t ) @@ -749,7 +751,7 @@ namespace Rokojori public static T GetDirectChild( this Node parent ) where T:Node { - if ( parent == null ) + if ( parent == null || ! Node.IsInstanceValid( parent ) ) { return null; } diff --git a/Runtime/Interactions/Collidable.cs b/Runtime/Interactions/Collidable.cs index e0af490..cb44ed9 100644 --- a/Runtime/Interactions/Collidable.cs +++ b/Runtime/Interactions/Collidable.cs @@ -7,6 +7,7 @@ namespace Rokojori { public enum CollisionPhase { + None, Entered, Inside, Exit @@ -52,12 +53,26 @@ namespace Rokojori return collisionTypes.IndexOf( collider.collisionType ) != -1; } + Collider _collider; + CollisionPhase _collisionPhase; + + public Collider collider => _collider; + public CollisionPhase collisionPhase => _collisionPhase; + + public void Collide( Collider collider, CollisionPhase phase ) { + // this.LogInfo( "Colliding with", phase, HierarchyName.Of( collider ) ); + + _collider = collider; + _collisionPhase = phase; + _Collide( collider, phase ); if ( phase == CollisionPhase.Entered ) { + // this.LogInfo( "Entered", HierarchyName.Of( collider ) ); + if ( onEnteredColliderPose != null ) { onEnteredColliderPose.CopyGlobalPoseFrom( collider.area ); @@ -68,6 +83,8 @@ namespace Rokojori } else if ( phase == CollisionPhase.Inside ) { + // this.LogInfo( "Inside", HierarchyName.Of( collider ) ); + if ( onInsideColliderPose != null ) { onInsideColliderPose.CopyGlobalPoseFrom( collider.area ); @@ -78,6 +95,8 @@ namespace Rokojori } else if ( phase == CollisionPhase.Exit ) { + // this.LogInfo( "Exit", HierarchyName.Of( collider ) ); + if ( onExitColliderPose != null ) { onExitColliderPose.CopyGlobalPoseFrom( collider.area ); @@ -86,6 +105,9 @@ namespace Rokojori Action.Trigger( collider.onExit ); Action.Trigger( onExit ); } + + _collider = null; + _collisionPhase = CollisionPhase.None; } protected virtual void _Collide( Collider collider, CollisionPhase phase ) diff --git a/Runtime/Interactions/Collider.cs b/Runtime/Interactions/Collider.cs index 87d97fb..3ec7e99 100644 --- a/Runtime/Interactions/Collider.cs +++ b/Runtime/Interactions/Collider.cs @@ -23,6 +23,10 @@ namespace Rokojori [Export] public Action onExit; + [Export] + public bool activateAlwaysOnInside = false; + + Dictionary _inside = new Dictionary(); public void OnNodeStateChanged() @@ -44,28 +48,69 @@ namespace Rokojori area.AreaEntered += TriggerOnEnter; area.BodyEntered += TriggerOnEnter; - area.AreaExited += TriggerOnExited; - area.BodyExited += TriggerOnExited; + area.AreaExited += _TriggerOnExited; + area.BodyExited += _TriggerOnExited; } - - void TriggerOnEnter( Node n ) + public void TriggerOnCollisionEnter( Projectile p, KinematicCollision3D collision ) { - if ( ! Math3D.IsValid( area.GlobalPosition ) ) + // this.LogInfo( "Collider:", collision.GetCollider( 0 ), "Shape:", collision.GetColliderShape( 0 ) ); + _TriggerOnEnter( (Node) collision.GetCollider( 0 ) ); + } + + public void TriggerOnCollisionExit( Projectile p, KinematicCollision3D collision ) + { + // this.LogInfo( "Collider:", collision.GetCollider( 0 ), "Shape:", collision.GetColliderShape( 0 ) ); + _TriggerOnExited( (Node) collision.GetCollider( 0 ) ); + } + + public void TriggerOnEnter( Node3D node3D ) + { + // this.LogInfo( "Collider:", collision.GetCollider( 0 ), "Shape:", collision.GetColliderShape( 0 ) ); + _TriggerOnEnter( node3D ); + } + + public void TriggerOnExited( Node3D node3D ) + { + // this.LogInfo( HierarchyName.Of( node3D ) ); + _TriggerOnExited( node3D ); + } + + Collidable GetCollidable( Node n ) + { + if ( n is Collidable c && c.IsCollidingWith( this ) ) { - return; - } + return c; + } - var collidable = n.Get(); + return n.FindDirectChild( c => c.IsCollidingWith( this ) ); - if ( collidable == null || ! collidable.IsCollidingWith( this ) ) + } + + void _TriggerOnEnter( Node n ) + { + if ( n == null ) { return; } + if ( area != null && ! Math3D.IsValid( area.GlobalPosition ) ) + { + return; + } + + + var collidable = GetCollidable( n ); + + if ( collidable == null ) + { + return; + } + + collidable.Collide( this, CollisionPhase.Entered ); - if ( onInside == null ) + if ( ( ! activateAlwaysOnInside ) && onInside == null ) { return; } @@ -87,11 +132,11 @@ namespace Rokojori } - void TriggerOnExited( Node n ) + void _TriggerOnExited( Node n ) { - var collidable = n.Get(); + var collidable = GetCollidable( n ); - if ( collidable == null || ! collidable.IsCollidingWith( this ) ) + if ( collidable == null ) { return; } diff --git a/Runtime/Interactions/CollisionFlag.cs b/Runtime/Interactions/CollisionFlag.cs index a10ab58..337aed1 100644 --- a/Runtime/Interactions/CollisionFlag.cs +++ b/Runtime/Interactions/CollisionFlag.cs @@ -7,7 +7,7 @@ using System.Drawing; namespace Rokojori { [Tool] - [GlobalClass,Icon("res://addons/rokojori_action_library/Icons/SelectorFlag.svg")] + [GlobalClass] public partial class CollisionFlag:SelectorFlag { diff --git a/Runtime/Interactions/MultiRayCaster.cs b/Runtime/Interactions/MultiRayCaster.cs index 821c970..a4a7d73 100644 --- a/Runtime/Interactions/MultiRayCaster.cs +++ b/Runtime/Interactions/MultiRayCaster.cs @@ -19,7 +19,7 @@ namespace Rokojori public float rayLength = 10; [Export] - public int maxHits = 100; + public int maxHits = 3; [Export] public bool sortByPointerPriority; @@ -38,9 +38,8 @@ namespace Rokojori public override int NumColliders() { - return numCollisions; + return collisions == null ? 0 : numCollisions; } - public override Node GetCollider( int index ) { @@ -85,9 +84,12 @@ namespace Rokojori } + [Export] + public bool runInEditor = false; + void Update( double delta ) { - if ( Engine.IsEditorHint() ) + if ( Engine.IsEditorHint() && ! runInEditor ) { return; @@ -132,7 +134,7 @@ namespace Rokojori var excludes = new Array(); var from = GlobalPosition; - var to = from + this.GlobalForward() * rayLength; + var to = from + this.GlobalForward().Normalized() * rayLength; this.to = to; @@ -148,7 +150,7 @@ namespace Rokojori var collisionData = GetCollisionData( numCollisions ); collisionData.Get( rayParameters, physics ); - if ( ! collisionData.hasCollision ) + if ( ! collisionData.hasCollision || this.DistanceTo( collisionData.position ) > rayLength ) { return; } diff --git a/Runtime/Math/Geometry/Plane3.cs b/Runtime/Math/Geometry/Plane3.cs index f6b056b..bb62ca0 100644 --- a/Runtime/Math/Geometry/Plane3.cs +++ b/Runtime/Math/Geometry/Plane3.cs @@ -120,6 +120,13 @@ namespace Rokojori SetFromNormalAndCoplanarPoint( normal, a ); } + public static Plane3 CreateFromNormalAndCoplanarPoint( Vector3 normal, Vector3 point ) + { + var p = new Plane3(); + p.SetFromNormalAndCoplanarPoint( normal, point ); + return p; + } + public static Plane3 FromCoplanarPoints( Vector3 a, Vector3 b, Vector3 c ) { var p = new Plane3(); diff --git a/Runtime/Physics/CollisionData.cs b/Runtime/Physics/CollisionData.cs index f104fb7..325d235 100644 --- a/Runtime/Physics/CollisionData.cs +++ b/Runtime/Physics/CollisionData.cs @@ -61,9 +61,7 @@ namespace Rokojori { var result = physicsState.IntersectRay( ray ); - - - if ( ! result.ContainsKey( "collider" ) ) + if ( ! result.ContainsKey( "collider" ) || result[ "collider" ].As() == null ) { hasCollision = false; return; diff --git a/Runtime/Physics/Projectile.cs b/Runtime/Physics/Projectile.cs new file mode 100644 index 0000000..23bc846 --- /dev/null +++ b/Runtime/Physics/Projectile.cs @@ -0,0 +1,59 @@ +using Godot; +using System.Collections; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class Projectile:CharacterBody3D + { + [Export] + public float speed = 0; + + [Export] + public bool disableOnCollision = false; + + [Export] + public bool disabled = false; + + [Export] + public Collider collider; + + [Export] + public Action onCollision; + + [Export] + public bool runInEditor = false; + + + public override void _PhysicsProcess( double delta ) + { + if ( disabled || ( Engine.IsEditorHint() && ! runInEditor ) ) + { + return; + } + + var velocity = this.GlobalForward() * speed * (float)delta; + + var collision = MoveAndCollide( velocity ); + + if ( collision == null ) + { + return; + } + + if ( collider != null) + { + collider.TriggerOnCollisionEnter( this, collision ); + } + + Action.Trigger( onCollision ); + + if ( disableOnCollision ) + { + disabled = true; + } + } + } +} \ No newline at end of file diff --git a/Runtime/Physics/Projectile.cs.uid b/Runtime/Physics/Projectile.cs.uid new file mode 100644 index 0000000..e8b5fcb --- /dev/null +++ b/Runtime/Physics/Projectile.cs.uid @@ -0,0 +1 @@ +uid://baohlfn1nwjsk diff --git a/Runtime/Rendering/TextureAttributes/SetTextureAttributeChannel.cs b/Runtime/Rendering/TextureAttributes/SetTextureAttributeChannel.cs index ba10d0a..12c556c 100644 --- a/Runtime/Rendering/TextureAttributes/SetTextureAttributeChannel.cs +++ b/Runtime/Rendering/TextureAttributes/SetTextureAttributeChannel.cs @@ -35,11 +35,11 @@ namespace Rokojori if ( ta == null ) { - this.LogInfo( "No attributes found..." ); + // this.LogInfo( "No attributes found..." ); return; } - this.LogInfo( "Index", index, "Value:", value, "Channel:", channel ); + // this.LogInfo( "Index", index, "Value:", value, "Channel:", channel ); ta.SetChannel( index, value, channel, operatorType ); } } diff --git a/Runtime/Sensors/SensorManager.cs b/Runtime/Sensors/SensorManager.cs index 7fb0d29..adf6bf3 100644 --- a/Runtime/Sensors/SensorManager.cs +++ b/Runtime/Sensors/SensorManager.cs @@ -20,6 +20,9 @@ namespace Rokojori [Export] public bool processSensors = true; + [Export] + public bool autoScan = true; + [Export] public Node[] autoScanForSensors = []; @@ -135,7 +138,7 @@ namespace Rokojori hasDevice = true; - this.LogInfo( "Device Type Change:", lastActiveDevice.GetInfo() ); + // this.LogInfo( "Device Type Change:", lastActiveDevice.GetInfo() ); if ( confineMouse && DefaultSensorDeviceSelector.IsMouseDevice( lastActiveDevice ) ) { @@ -378,7 +381,9 @@ namespace Rokojori typeof( Area3D ), typeof( CharacterBody3D ), typeof( AudioStreamPlayer3D ), - typeof( ReflectionProbe ) + typeof( ReflectionProbe ), + typeof( SensorManager ), + typeof( SensorManagerSetup ) }; @@ -495,6 +500,20 @@ namespace Rokojori Nodes.ForEach( n, n => AddSensorsFrom( n ) ); } + if ( autoScan ) + { + this.ForEachInRoot( + ( n )=> + { + if ( IsIgnoreType( n ) ) + { + return; + } + + AddSensorsFrom( n ); + } + ); + } // if ( autoScanParent ) // { // Nodes.ForEach( GetParent(), AddSensorsFrom ); diff --git a/Runtime/Sensors/SensorManagerSetup.cs b/Runtime/Sensors/SensorManagerSetup.cs index 55a3fe2..83d11c1 100644 --- a/Runtime/Sensors/SensorManagerSetup.cs +++ b/Runtime/Sensors/SensorManagerSetup.cs @@ -11,6 +11,10 @@ namespace Rokojori [Export] public bool initializeOnReady = true; + [Export] + public bool processSensors = true; + + [ExportGroup( "Sensor Scanning" )] [Export] public Sensor[] sensors = []; @@ -18,7 +22,7 @@ namespace Rokojori public SensorGroup[] sensorGroups = []; [Export] - public bool processSensors = true; + public bool autoScan = true; [Export] public Node[] autoScanForSensors = []; @@ -26,6 +30,8 @@ namespace Rokojori [Export] public bool autoScanParent = true; + [ExportGroup( "Debugging Options")] + [Export] public bool separateMouseAndKeyboardTracking = false; @@ -50,6 +56,7 @@ namespace Rokojori sm.sensors = sensors; sm.sensorGroups = sensorGroups; sm.processSensors = processSensors; + sm.autoScan = autoScan; sm.autoScanForSensors = autoScanForSensors; sm.separateMouseAndKeyboardTracking = separateMouseAndKeyboardTracking; sm.onActiveDeviceChange = onActiveDeviceChange; diff --git a/Runtime/Time/TimeLine.cs b/Runtime/Time/TimeLine.cs index b1225cd..8afdefc 100644 --- a/Runtime/Time/TimeLine.cs +++ b/Runtime/Time/TimeLine.cs @@ -27,6 +27,9 @@ namespace Rokojori [Export] public bool autoStart = true; + [Export] + public bool executesInPause = false; + public static float osTime => (float)( Time.GetTicksMsec() / 1000.0 ); public TimeLineRunner runner diff --git a/Runtime/Time/TimeLineManager.cs b/Runtime/Time/TimeLineManager.cs index 952bd0d..a366c2b 100644 --- a/Runtime/Time/TimeLineManager.cs +++ b/Runtime/Time/TimeLineManager.cs @@ -56,10 +56,15 @@ namespace Rokojori public bool inProcess => _inProcess; + bool _paused = false; + public bool paused => _paused; + public override void _Process( double delta ) { _inProcess = true; + _paused = GetTree().Paused; + UpdateRealTime( delta ); if ( ! Engine.IsEditorHint() && gametimeTimeline != null ) diff --git a/Runtime/Time/TimeLineRunner.cs b/Runtime/Time/TimeLineRunner.cs index 3cdb7ca..4aaa268 100644 --- a/Runtime/Time/TimeLineRunner.cs +++ b/Runtime/Time/TimeLineRunner.cs @@ -57,7 +57,7 @@ namespace Rokojori public void UpdateTimeLine( float realtimeDelta ) { - if ( ! playing ) + if ( ! playing || ( manager.paused && ! timeLine.executesInPause )) { return; } diff --git a/Runtime/Time/TimeLines/RealTime.tres b/Runtime/Time/TimeLines/RealTime.tres index 416fa42..86758f0 100644 --- a/Runtime/Time/TimeLines/RealTime.tres +++ b/Runtime/Time/TimeLines/RealTime.tres @@ -1,6 +1,7 @@ [gd_resource type="Resource" script_class="TimeLine" load_steps=2 format=3 uid="uid://h6oi6vkj4c2m"] -[ext_resource type="Script" path="res://addons/rokojori_action_library/Runtime/Time/TimeLine.cs" id="1_0ltdh"] +[ext_resource type="Script" uid="uid://fqm54rn8fnnl" path="res://addons/rokojori_action_library/Runtime/Time/TimeLine.cs" id="1_0ltdh"] [resource] script = ExtResource("1_0ltdh") +executesInPause = true diff --git a/Runtime/Time/TimeLines/UITime.tres b/Runtime/Time/TimeLines/UITime.tres index 483564e..596d834 100644 --- a/Runtime/Time/TimeLines/UITime.tres +++ b/Runtime/Time/TimeLines/UITime.tres @@ -4,8 +4,4 @@ [resource] script = ExtResource("1_xynux") -isLooping = false -loopStart = 0.0 -loopEnd = 100000.0 -startSpeed = 1.0 -autoStart = true +executesInPause = true diff --git a/Runtime/UI/Nodes/UIInputInfo.cs b/Runtime/UI/Nodes/UIInputInfo.cs index 5045bed..e2e9f55 100644 --- a/Runtime/UI/Nodes/UIInputInfo.cs +++ b/Runtime/UI/Nodes/UIInputInfo.cs @@ -57,19 +57,19 @@ namespace Rokojori if ( iiLib == null ) { - this.LogInfo( "No Input lib!" ); + // this.LogInfo( "No Input lib!" ); return; } var icons = iiLib.ResolveIcons( inputIcons ); - this.LogInfo( "Resolved Icons:\n", inputIcons, "\n>>\n", icons ); + // this.LogInfo( "Resolved Icons:\n", inputIcons, "\n>>\n", icons ); if ( deviceFilter != null ) { var iconsBefore = Lists.From( icons ); icons = Lists.Filter( icons, i => deviceFilter.BelongsToDevice( i ) ); - this.LogInfo( "Device Filtered Icons:\n", iconsBefore, "\n>>\n", icons ); + // this.LogInfo( "Device Filtered Icons:\n", iconsBefore, "\n>>\n", icons ); } icons = iiLib.ResolveIcons( icons.ToArray() ); @@ -84,7 +84,7 @@ namespace Rokojori localeText.locale = locale; localeText.font = iiLib.font; - localeText.fontSize = iiLib.fontSize; + localeText.fontSize = this.fontSize != null ? this.fontSize : iiLib.fontSize; localeText.Uppercase = upperCase; localeText.marginLeft = UINumber.EM( 0.25f ); @@ -134,11 +134,11 @@ namespace Rokojori if ( id == null ) { - this.LogInfo( "No definition found >> ", inputIcon ); + // this.LogInfo( "No definition found >> ", inputIcon ); return; } - this.LogInfo( "Definition found >> ", inputIcon ); + // this.LogInfo( "Definition found >> ", inputIcon ); var iconRegion = this.CreateChild(); var elements = id.GetIconElementsForIcon( inputIcon ); diff --git a/Runtime/UI/UI-Settings-Default.tres b/Runtime/UI/UI-Settings-Default.tres index 14ea497..aae1f2d 100644 --- a/Runtime/UI/UI-Settings-Default.tres +++ b/Runtime/UI/UI-Settings-Default.tres @@ -9,7 +9,7 @@ [sub_resource type="Resource" id="Resource_wm644"] script = ExtResource("3_xon8j") -value = 0.5 +value = 1.5 unit = "vw" metadata/_custom_type_script = "uid://cnkyynboxg1qg"