From 9c1d66f61fc0050d02698b4ec2d9eec881745aa4 Mon Sep 17 00:00:00 2001 From: greerdv Date: Thu, 15 Jul 2021 13:07:34 +0100 Subject: [PATCH] improve translations for physics types in Script Canvas Signed-off-by: greerdv --- .../Editor/Translation/scriptcanvas_en_us.ts | 447 +++++++++++++----- .../Physics/Common/PhysicsSceneQueries.cpp | 34 +- .../AzFramework/Physics/PhysicsSystem.cpp | 5 +- 3 files changed, 355 insertions(+), 131 deletions(-) diff --git a/Assets/Editor/Translation/scriptcanvas_en_us.ts b/Assets/Editor/Translation/scriptcanvas_en_us.ts index 5cafabaf60..f057ba2f30 100644 --- a/Assets/Editor/Translation/scriptcanvas_en_us.ts +++ b/Assets/Editor/Translation/scriptcanvas_en_us.ts @@ -42001,245 +42001,255 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro WORLD_RAYCASTMULTIPLELOCALSPACE_OUTPUT0_NAME Hits - - WORLD_OVERLAPSPHERE_NAME + + WORLD_OVERLAPSPHEREWITHGROUP_NAME Overlap Sphere - - WORLD_OVERLAPSPHERE_PARAM0_NAME + + WORLD_OVERLAPSPHEREWITHGROUP_PARAM0_NAME Position - - WORLD_OVERLAPSPHERE_PARAM1_NAME + + WORLD_OVERLAPSPHEREWITHGROUP_PARAM1_NAME Radius - - WORLD_OVERLAPSPHERE_PARAM2_NAME + + WORLD_OVERLAPSPHEREWITHGROUP_PARAM2_NAME Collision Group - - WORLD_OVERLAPSPHERE_PARAM3_NAME + + WORLD_OVERLAPSPHEREWITHGROUP_PARAM3_NAME Ignore - - WORLD_OVERLAPSPHERE_OUTPUT0_NAME + + WORLD_OVERLAPSPHEREWITHGROUP_OUTPUT0_NAME Is Overlapping - - WORLD_OVERLAPSPHERE_OUTPUT1_NAME + + WORLD_OVERLAPSPHEREWITHGROUP_OUTPUT1_NAME Overlaps - - WORLD_OVERLAPBOX_NAME + + WORLD_OVERLAPBOXWITHGROUP_NAME Overlap Box - - WORLD_OVERLAPBOX_PARAM0_NAME + + WORLD_OVERLAPBOXWITHGROUP_PARAM0_NAME Pose - - WORLD_OVERLAPBOX_PARAM1_NAME + + WORLD_OVERLAPBOXWITHGROUP_PARAM1_NAME Dimensions - - WORLD_OVERLAPBOX_PARAM2_NAME + + WORLD_OVERLAPBOXWITHGROUP_PARAM2_NAME Collision Group - - WORLD_OVERLAPBOX_PARAM3_NAME + + WORLD_OVERLAPBOXWITHGROUP_PARAM3_NAME Ignore - - WORLD_OVERLAPBOX_OUTPUT0_NAME + + WORLD_OVERLAPBOXWITHGROUP_OUTPUT0_NAME Is Overlapping - - WORLD_OVERLAPBOX_OUTPUT1_NAME + + WORLD_OVERLAPBOXWITHGROUP_OUTPUT1_NAME Overlaps - - WORLD_OVERLAPCAPSULE_NAME + + WORLD_OVERLAPCAPSULEWITHGROUP_NAME Overlap Capsule - - WORLD_OVERLAPCAPSULE_PARAM0_NAME + + WORLD_OVERLAPCAPSULEWITHGROUP_PARAM0_NAME Pose - - WORLD_OVERLAPCAPSULE_PARAM1_NAME + + WORLD_OVERLAPCAPSULEWITHGROUP_PARAM1_NAME Height - - WORLD_OVERLAPCAPSULE_PARAM2_NAME + + WORLD_OVERLAPCAPSULEWITHGROUP_PARAM2_NAME Radius - - WORLD_OVERLAPCAPSULE_PARAM3_NAME + + WORLD_OVERLAPCAPSULEWITHGROUP_PARAM3_NAME Collision Group - - WORLD_OVERLAPCAPSULE_PARAM4_NAME + + WORLD_OVERLAPCAPSULEWITHGROUP_PARAM4_NAME Ignore - - WORLD_OVERLAPCAPSULE_OUTPUT0_NAME + + WORLD_OVERLAPCAPSULEWITHGROUP_OUTPUT0_NAME Is Overlapping - - WORLD_OVERLAPCAPSULE_OUTPUT1_NAME + + WORLD_OVERLAPCAPSULEWITHGROUP_OUTPUT1_NAME Overlaps - - - - WORLD_SPHERECAST_NAME + + + WORLD_SPHERECASTWITHGROUP_NAME Sphere Cast - - WORLD_SPHERECAST_PARAM0_NAME + + WORLD_SPHERECASTWITHGROUP_PARAM0_NAME Distance - - WORLD_SPHERECAST_PARAM1_NAME + + WORLD_SPHERECASTWITHGROUP_PARAM1_NAME Start Pose - - WORLD_SPHERECAST_PARAM2_NAME + + WORLD_SPHERECASTWITHGROUP_PARAM2_NAME Direction - - WORLD_SPHERECAST_PARAM3_NAME + + WORLD_SPHERECASTWITHGROUP_PARAM3_NAME Radius - - WORLD_SPHERECAST_PARAM4_NAME + + WORLD_SPHERECASTWITHGROUP_PARAM4_NAME Collision Group - - WORLD_SPHERECAST_PARAM5_NAME + + WORLD_SPHERECASTWITHGROUP_PARAM5_NAME Ignore - - WORLD_SPHERECAST_OUTPUT0_NAME + + WORLD_SPHERECASTWITHGROUP_OUTPUT0_NAME Object Hit - - WORLD_SPHERECAST_OUTPUT1_NAME + + WORLD_SPHERECASTWITHGROUP_OUTPUT1_NAME Position - - WORLD_SPHERECAST_OUTPUT2_NAME + + WORLD_SPHERECASTWITHGROUP_OUTPUT2_NAME Normal - - WORLD_SPHERECAST_OUTPUT3_NAME + + WORLD_SPHERECASTWITHGROUP_OUTPUT3_NAME Distance - - WORLD_SPHERECAST_OUTPUT4_NAME + + WORLD_SPHERECASTWITHGROUP_OUTPUT4_NAME EntityId - - - WORLD_BOXCAST_NAME + + WORLD_BOXCASTWITHGROUP_NAME Box Cast - - WORLD_BOXCAST_PARAM0_NAME + + WORLD_BOXCASTWITHGROUP_PARAM0_NAME Distance - - WORLD_BOXCAST_PARAM1_NAME + + WORLD_BOXCASTWITHGROUP_PARAM1_NAME Start Pose - - WORLD_BOXCAST_PARAM2_NAME + + WORLD_BOXCASTWITHGROUP_PARAM2_NAME Direction - - WORLD_BOXCAST_PARAM3_NAME + + WORLD_BOXCASTWITHGROUP_PARAM3_NAME Dimensions - - WORLD_BOXCAST_PARAM4_NAME + + WORLD_BOXCASTWITHGROUP_PARAM4_NAME Collision Group - - WORLD_BOXCAST_PARAM5_NAME + + WORLD_BOXCASTWITHGROUP_PARAM5_NAME Ignore - - WORLD_BOXCAST_OUTPUT0_NAME + + WORLD_BOXCASTWITHGROUP_OUTPUT0_NAME Object Hit - - WORLD_BOXCAST_OUTPUT1_NAME + + WORLD_BOXCASTWITHGROUP_OUTPUT1_NAME Position - - WORLD_BOXCAST_OUTPUT2_NAME + + WORLD_BOXCASTWITHGROUP_OUTPUT2_NAME Normal - - WORLD_BOXCAST_OUTPUT3_NAME + + WORLD_BOXCASTWITHGROUP_OUTPUT3_NAME Distance - - WORLD_BOXCAST_OUTPUT4_NAME + + WORLD_BOXCASTWITHGROUP_OUTPUT4_NAME EntityId - - - WORLD_CAPSULECAST_NAME + + WORLD_CAPSULECASTWITHGROUP_NAME Capsule Cast - - WORLD_CAPSULECAST_PARAM0_NAME + + WORLD_CAPSULECASTWITHGROUP_PARAM0_NAME Distance - - WORLD_CAPSULECAST_PARAM1_NAME + + WORLD_CAPSULECASTWITHGROUP_PARAM1_NAME Start Pose - - WORLD_CAPSULECAST_PARAM2_NAME + + WORLD_CAPSULECASTWITHGROUP_PARAM2_NAME Direction - - WORLD_CAPSULECAST_PARAM3_NAME + + WORLD_CAPSULECASTWITHGROUP_PARAM3_NAME Height - - WORLD_CAPSULECAST_PARAM4_NAME + + WORLD_CAPSULECASTWITHGROUP_PARAM4_NAME Radius - - WORLD_CAPSULECAST_PARAM5_NAME + + WORLD_CAPSULECASTWITHGROUP_PARAM5_NAME Collision Group - - WORLD_CAPSULECAST_PARAM6_NAME + + WORLD_CAPSULECASTWITHGROUP_PARAM6_NAME Ignore - - WORLD_CAPSULECAST_OUTPUT0_NAME + + WORLD_CAPSULECASTWITHGROUP_OUTPUT0_NAME Object Hit - - WORLD_CAPSULECAST_OUTPUT1_NAME + + WORLD_CAPSULECASTWITHGROUP_OUTPUT1_NAME + WORLD_CAPSULECASTWITHGROUP_OUTPUT1_NAME Position - - WORLD_BOXCAST_OUTPUT2_NAME + + WORLD_CAPSULECASTWITHGROUP_OUTPUT2_NAME Normal - - WORLD_CAPSULECAST_OUTPUT3_NAME + + WORLD_CAPSULECASTWITHGROUP_OUTPUT3_NAME Distance - - WORLD_CAPSULECAST_OUTPUT4_NAME + + WORLD_CAPSULECASTWITHGROUP_OUTPUT4_NAME EntityId + + WORLD_RAYCASTLOCALSPACEWITHGROUP_NAME + Raycast (Local Space) + + + WORLD_RAYCASTMULTIPLELOCALSPACEWITHGROUP_NAME + Raycast Multiple (Local Space) + + + WORLD_RAYCASTWORLDSPACEWITHGROUP_NAME + Raycast (World Space) + EBus: CollisionFilteringBus @@ -42368,7 +42378,7 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro EBus: RigidBodyRequestBus RIGIDBODYREQUESTBUS_NAME - RigidBody + Rigid Body RIGIDBODYREQUESTBUS_TOOLTIP @@ -42413,6 +42423,23 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro RIGIDBODYREQUESTBUS_ISPHYSICSENABLED_OUTPUT0_TOOLTIP Indicates whether physics is enabled + + RIGIDBODYREQUESTBUS_ISGRAVITYENABLED_NAME + Class/Bus: RigidBodyRequestBus Event/Method: IsGravityEnabled + Is Gravity Enabled + + + RIGIDBODYREQUESTBUS_ISGRAVITYENABLED_TOOLTIP + Returns true if the rigid body has gravity enabled + + + RIGIDBODYREQUESTBUS_ISGRAVITYENABLED_OUTPUT0_NAME + Enabled + + + RIGIDBODYREQUESTBUS_ISGRAVITYENABLED_OUTPUT0_TOOLTIP + Indicates whether gravity is enabled + RIGIDBODYREQUESTBUS_GETCENTEROFMASSWORLD_NAME Class/Bus: RigidBodyRequestBus Event/Method: GetCenterOfMassWorld @@ -42915,7 +42942,50 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro RIGIDBODYREQUESTBUS_GETAABB_OUTPUT0_TOOLTIP The aabb of the rigid body - + + + Method: SceneQueries + + SCENEQUERIES_NAME + Scene Queries + + + SCENEQUERIES_CREATERAYCASTREQUEST_NAME + Create Raycast Request + + + SCENEQUERIES_CREATERAYCASTREQUEST_PARAM0_NAME + Start + + + SCENEQUERIES_CREATERAYCASTREQUEST_PARAM0_TOOLTIP + The position from which the raycast starts + + + SCENEQUERIES_CREATERAYCASTREQUEST_PARAM1_NAME + Direction + + + SCENEQUERIES_CREATERAYCASTREQUEST_PARAM1_TOOLTIP + The (normalized) direction in which to fire the raycast + + + SCENEQUERIES_CREATERAYCASTREQUEST_PARAM2_NAME + Distance + + + SCENEQUERIES_CREATERAYCASTREQUEST_PARAM2_TOOLTIP + The length of the raycast + + + SCENEQUERIES_CREATERAYCASTREQUEST_PARAM3_NAME + Collision Group + + + SCENEQUERIES_CREATERAYCASTREQUEST_PARAM3_TOOLTIP + Allows filtering of objects intersecting the raycast based on their collision layers + + Handler: TriggerNotificationBus @@ -43199,12 +43269,12 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro PHYSXCHARACTERCONTROLLERREQUESTBUS_NAME Character Controller (PhysX Specific) - - CHARACTERCONTROLLERREQUESTBUS_TOOLTIP + + PHYSXCHARACTERCONTROLLERREQUESTBUS_TOOLTIP PhysX Character Controller Request Bus - - CHARACTERCONTROLLERREQUESTBUS_CATEGORY + + PHYSXCHARACTERCONTROLLERREQUESTBUS_CATEGORY PhysX @@ -44616,6 +44686,96 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro + + EBus: SimulatedBodyComponentRequestBus + + SIMULATEDBODYCOMPONENTREQUESTBUS_NAME + Simulated Body + + + SIMULATEDBODYCOMPONENTREQUESTBUS_TOOLTIP + Simulated Body Component Request Bus + + + SIMULATEDBODYCOMPONENTREQUESTBUS_CATEGORY + PhysX + + + SIMULATEDBODYCOMPONENTREQUESTBUS_DISABLEPHYSICS_NAME + Disable Physics + + + SIMULATEDBODYCOMPONENTREQUESTBUS_ENABLEPHYSICS_NAME + Enable Physics + + + SIMULATEDBODYCOMPONENTREQUESTBUS_GETAABB_NAME + Get AABB + + + SIMULATEDBODYCOMPONENTREQUESTBUS_ISPHYSICSENABLED_NAME + Is Physics Enabled + + + SIMULATEDBODYCOMPONENTREQUESTBUS_RAYCAST_NAME + Raycast (Single Body) + + + SIMULATEDBODYCOMPONENTREQUESTBUS_RAYCAST_TOOLTIP + Perform a raycast against a single simulated body (not the whole scene) + + + SIMULATEDBODYCOMPONENTREQUESTBUS_RAYCAST_PARAM0_NAME + Raycast Request + + + + EBus: WindRequestsBus + + WINDREQUESTSBUS_NAME + Wind + + + WINDREQUESTSBUS_TOOLTIP + Wind Request Bus + + + WINDREQUESTSBUS_CATEGORY + PhysX + + + WINDREQUESTSBUS_GETGLOBALWIND_NAME + Get Global Wind + + + WINDREQUESTSBUS_GETGLOBALWIND_OUTPUT0_NAME + Wind Vector + + + WINDREQUESTSBUS_GETWINDATPOSITION_NAME + Get Wind At Position + + + WINDREQUESTSBUS_GETWINDATPOSITION_PARAM0_NAME + Position + + + WINDREQUESTSBUS_GETWINDATPOSITION_OUTPUT0_NAME + Wind Vector + + + WINDREQUESTSBUS_GETWINDINSIDEAABB_NAME + Get Wind Inside AABB + + + WINDREQUESTSBUS_GETWINDINSIDEAABB_PARAM0_NAME + AABB + + + WINDREQUESTSBUS_GETWINDINSIDEAABB_OUTPUT0_NAME + Wind Vector + + EBus: ChatPlayRequestBus @@ -62374,6 +62534,37 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro + + EBus: NonUniformScaleRequestBus + + NONUNIFORMSCALEREQUESTBUS_NAME + Non-uniform Scale + + + NONUNIFORMSCALEREQUESTBUS_TOOLTIP + Non-uniform Scale Request Bus + + + NONUNIFORMSCALEREQUESTBUS_CATEGORY + Entity + + + NONUNIFORMSCALEREQUESTBUS_GETSCALE_NAME + Get Scale + + + NONUNIFORMSCALEREQUESTBUS_GETSCALE_OUTPUT0_NAME + Non-uniform Scale + + + NONUNIFORMSCALEREQUESTBUS_SETSCALE_NAME + Set Scale + + + NONUNIFORMSCALEREQUESTBUS_SETSCALE_PARAM0_NAME + Non-uniform Scale + + EBus: TransformBus diff --git a/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsSceneQueries.cpp b/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsSceneQueries.cpp index 02597123db..bf5c191bef 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsSceneQueries.cpp +++ b/Code/Framework/AzFramework/AzFramework/Physics/Common/PhysicsSceneQueries.cpp @@ -66,6 +66,17 @@ namespace AzPhysics } } + // class for exposing free functions to script + class SceneQueries + { + public: + AZ_TYPE_INFO(SceneQueries, "{4EFA3DA5-C0E3-4753-8C55-202228CA527E}"); + AZ_CLASS_ALLOCATOR(SceneQueries, AZ::SystemAllocator, 0); + + SceneQueries() = default; + ~SceneQueries() = default; + }; + /*static*/ void SceneQueryRequest::Reflect(AZ::ReflectContext* context) { if (auto* serializeContext = azdynamic_cast(context)) @@ -95,6 +106,7 @@ namespace AzPhysics ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common) ->Attribute(AZ::Script::Attributes::Module, "physics") ->Attribute(AZ::Script::Attributes::Category, "PhysX") + ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All) ->Property("Collision", BehaviorValueProperty(&SceneQueryRequest::m_collisionGroup)) // Until enum class support for behavior context is done, expose this as an int ->Property("QueryType", [](const SceneQueryRequest& self) { return static_cast(self.m_queryType); }, @@ -133,11 +145,28 @@ namespace AzPhysics ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common) ->Attribute(AZ::Script::Attributes::Module, "physics") ->Attribute(AZ::Script::Attributes::Category, "PhysX") + ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All) ->Property("Distance", BehaviorValueProperty(&RayCastRequest::m_distance)) ->Property("Start", BehaviorValueProperty(&RayCastRequest::m_start)) ->Property("Direction", BehaviorValueProperty(&RayCastRequest::m_direction)) ->Property("ReportMultipleHits", BehaviorValueProperty(&RayCastRequest::m_reportMultipleHits)) ; + + behaviorContext->Class("SceneQueries") + ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common) + ->Attribute(AZ::Script::Attributes::Module, "physics") + ->Attribute(AZ::Script::Attributes::Category, "PhysX") + ->Method( + "CreateRayCastRequest", + [](const AZ::Vector3& start, const AZ::Vector3& direction, float distance, const AZStd::string& collisionGroup) + { + RayCastRequest request; + request.m_start = start; + request.m_direction = direction; + request.m_distance = distance; + request.m_collisionGroup = CollisionGroup(collisionGroup); + return request; + }); } } @@ -161,6 +190,7 @@ namespace AzPhysics ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common) ->Attribute(AZ::Script::Attributes::Module, "physics") ->Attribute(AZ::Script::Attributes::Category, "PhysX") + ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All) ->Property("Distance", BehaviorValueProperty(&ShapeCastRequest::m_distance)) ->Property("Start", BehaviorValueProperty(&ShapeCastRequest::m_start)) ->Property("Direction", BehaviorValueProperty(&ShapeCastRequest::m_direction)) @@ -174,7 +204,6 @@ namespace AzPhysics return ShapeCastRequestHelpers::CreateSphereCastRequest( radius, startPose, direction, distance, queryType, collisionGroup, nullptr); }); - behaviorContext->Method( "CreateBoxCastRequest", [](const AZ::Vector3& boxDimensions, const AZ::Transform& startPose, const AZ::Vector3& direction, float distance, @@ -183,7 +212,6 @@ namespace AzPhysics return ShapeCastRequestHelpers::CreateBoxCastRequest( boxDimensions, startPose, direction, distance, queryType, collisionGroup, nullptr); }); - behaviorContext->Method( "CreateCapsuleCastRequest", [](float capsuleRadius, float capsuleHeight, const AZ::Transform& startPose, const AZ::Vector3& direction, float distance, @@ -266,6 +294,7 @@ namespace AzPhysics ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common) ->Attribute(AZ::Script::Attributes::Module, "physics") ->Attribute(AZ::Script::Attributes::Category, "PhysX") + ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All) ->Property("Pose", BehaviorValueProperty(&OverlapRequest::m_pose)) ; @@ -348,6 +377,7 @@ namespace AzPhysics ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common) ->Attribute(AZ::Script::Attributes::Module, "physics") ->Attribute(AZ::Script::Attributes::Category, "PhysX") + ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All) ->Property("Distance", BehaviorValueProperty(&SceneQueryHit::m_distance)) ->Property("Position", BehaviorValueProperty(&SceneQueryHit::m_position)) ->Property("Normal", BehaviorValueProperty(&SceneQueryHit::m_normal)) diff --git a/Code/Framework/AzFramework/AzFramework/Physics/PhysicsSystem.cpp b/Code/Framework/AzFramework/AzFramework/Physics/PhysicsSystem.cpp index 06f1802cc9..6299359b3f 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/PhysicsSystem.cpp +++ b/Code/Framework/AzFramework/AzFramework/Physics/PhysicsSystem.cpp @@ -50,7 +50,10 @@ namespace AzPhysics ->Method("GetOnPostsimulateEvent", getOnPostsimulateEvent) ->Attribute(AZ::Script::Attributes::AzEventDescription, postsimulateEventDescription) ->Method("GetSceneHandle", &SystemInterface::GetSceneHandle) - ->Method("GetScene", &SystemInterface::GetScene); + ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All) + ->Method("GetScene", &SystemInterface::GetScene) + ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All) + ; behaviorContext->Method( "GetPhysicsSystem",