Skip to content

[Reviewed] [3rd person camera] Allow to smooth the elevation angle #1637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
212 changes: 204 additions & 8 deletions extensions/reviewed/ThirdPersonCamera.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"author": "",
"category": "Camera",
"extensionNamespace": "",
"gdevelopVersion": ">=5.5.222",
"fullName": "Third person camera",
"gdevelopVersion": ">=5.5.222",
"helpPath": "",
"iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlnb24gY2xhc3M9InN0MCIgcG9pbnRzPSI3LDEwIDEsMTMgNywxNiAxMywxMyAiLz4NCjxwb2x5bGluZSBjbGFzcz0ic3QwIiBwb2ludHM9IjEsMTMgMSwyMCA3LDIzIDEzLDIwIDEzLDEzICIvPg0KPGxpbmUgY2xhc3M9InN0MCIgeDE9IjciIHkxPSIxNiIgeDI9IjciIHkyPSIyMyIvPg0KPGxpbmUgY2xhc3M9InN0MCIgeDE9IjMxIiB5MT0iMTYiIHgyPSIyMSIgeTI9IjgiLz4NCjxsaW5lIGNsYXNzPSJzdDAiIHgxPSIyMSIgeTE9IjI0IiB4Mj0iMzEiIHkyPSIxNiIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTIyLjcsMjIuNkMyMCwyMS43LDE4LDE5LjEsMTgsMTZjMC0zLjEsMi01LjcsNC43LTYuNiIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTE5LjgsMTEuM2MxLjQsMS4xLDIuMiwyLjgsMi4yLDQuN2MwLDEuOS0wLjksMy42LTIuMiw0LjciLz4NCjwvc3ZnPg0K",
"name": "ThirdPersonCamera",
"previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Virtual Reality/94e95d2c318e1f3dc7151a351024e13c574e1e44669c6696aa107d60230073f6_Virtual Reality_3d_vision_eye_vr.svg",
"shortDescription": "Move the camera to look at an object from a given distance.",
"version": "1.6.1",
"version": "1.7.0",
"description": [
"Move the camera to look at an object from a given distance with a rotation and an elevation angles.",
"",
Expand Down Expand Up @@ -583,6 +583,18 @@
""
]
},
{
"type": {
"value": "ThirdPersonCamera::ThirdPersonCamera::SetElevationHalfwayDuration"
},
"parameters": [
"Object",
"Behavior",
"=",
"ElevationHalfwayDuration",
""
]
},
{
"type": {
"value": "ThirdPersonCamera::ThirdPersonCamera::SetTranslationZHalfwayDuration"
Expand Down Expand Up @@ -912,6 +924,33 @@
}
]
},
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [
{
"type": {
"value": "BooleanVariable"
},
"parameters": [
"IsElevatingWithObject",
"True",
""
]
}
],
"actions": [
{
"type": {
"value": "SetNumberVariable"
},
"parameters": [
"TargetedElevationAngle",
"=",
"Object.Object3D::RotationY()"
]
}
]
},
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
Expand All @@ -921,23 +960,33 @@
"value": "SetNumberVariable"
},
"parameters": [
"CameraAngle",
"CameraRotationAngle",
"=",
"TargetedRotationAngle + 90 + RotationAngleOffset + AngleDifference(CameraAngle(Object.Layer()), TargetedRotationAngle + 90 + RotationAngleOffset) * exp(TimeDelta() * RotationLogSpeed)"
]
},
{
"type": {
"value": "SetNumberVariable"
},
"parameters": [
"CameraElevationAngle",
"=",
"TargetedElevationAngle + ElevationAngleOffset + AngleDifference(90 - Scene3D::CameraRotationX(Object.Layer()), TargetedElevationAngle + ElevationAngleOffset) * exp(TimeDelta() * ElevationLogSpeed)"
]
},
{
"type": {
"value": "ThirdPersonCamera::LookFromDistanceAtPosition3D"
},
"parameters": [
"",
"Object.CenterX() + ThirdPersonCamera::RotatedX(CameraAngle, OffsetX, -OffsetY)",
"Object.CenterY() + ThirdPersonCamera::RotatedY(CameraAngle, OffsetX, -OffsetY)",
"Object.CenterX() + ThirdPersonCamera::RotatedX(CameraRotationAngle, OffsetX, -OffsetY)",
"Object.CenterY() + ThirdPersonCamera::RotatedY(CameraRotationAngle, OffsetX, -OffsetY)",
"CameraZ + OffsetZ",
"Distance",
"CameraAngle",
"Object.Object3D::RotationY() + ElevationAngleOffset",
"CameraRotationAngle",
"CameraElevationAngle",
"",
""
]
Expand All @@ -946,7 +995,12 @@
"variables": [
{
"folded": true,
"name": "CameraAngle",
"name": "CameraRotationAngle",
"type": "number",
"value": 0
},
{
"name": "CameraElevationAngle",
"type": "number",
"value": 0
}
Expand Down Expand Up @@ -1251,6 +1305,108 @@
],
"objectGroups": []
},
{
"description": "the halfway time for elevation rotation of the object.",
"fullName": "Halfway time for elevation rotation",
"functionType": "ExpressionAndCondition",
"group": "Third person camera configuration",
"name": "ElevationHalfwayDuration",
"sentence": "the halfway time for elevation rotation",
"events": [
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
"actions": [
{
"type": {
"value": "SetReturnNumber"
},
"parameters": [
"ElevationHalfwayDuration"
]
}
]
}
],
"expressionType": {
"type": "expression"
},
"parameters": [
{
"description": "Object",
"name": "Object",
"type": "object"
},
{
"description": "Behavior",
"name": "Behavior",
"supplementaryInformation": "ThirdPersonCamera::ThirdPersonCamera",
"type": "behavior"
}
],
"objectGroups": []
},
{
"fullName": "",
"functionType": "ActionWithOperator",
"getterName": "ElevationHalfwayDuration",
"name": "SetElevationHalfwayDuration",
"sentence": "",
"events": [
{
"type": "BuiltinCommonInstructions::Comment",
"color": {
"b": 109,
"g": 230,
"r": 255,
"textB": 0,
"textG": 0,
"textR": 0
},
"comment": "ln((1 - speed)) = ln(1 / 2) / halfwatTime"
},
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
"actions": [
{
"type": {
"value": "SetNumberVariable"
},
"parameters": [
"ElevationHalfwayDuration",
"=",
"Value"
]
},
{
"type": {
"value": "SetNumberVariable"
},
"parameters": [
"ElevationLogSpeed",
"=",
"log(0.5) / Value"
]
}
]
}
],
"parameters": [
{
"description": "Object",
"name": "Object",
"type": "object"
},
{
"description": "Behavior",
"name": "Behavior",
"supplementaryInformation": "ThirdPersonCamera::ThirdPersonCamera",
"type": "behavior"
}
],
"objectGroups": []
},
{
"description": "the halfway time on Z axis of the object.",
"fullName": "Halfway time on Z axis",
Expand Down Expand Up @@ -2190,6 +2346,16 @@
"extraInformation": [],
"name": "RotationHalfwayDuration"
},
{
"value": "0",
"type": "Number",
"unit": "Second",
"label": "Halfway time for elevation rotation",
"description": "",
"group": "Catch-up speed",
"extraInformation": [],
"name": "ElevationHalfwayDuration"
},
{
"value": "0.125",
"type": "Number",
Expand Down Expand Up @@ -2292,6 +2458,16 @@
"hidden": true,
"name": "RotationLogSpeed"
},
{
"value": "",
"type": "Number",
"label": "",
"description": "",
"group": "",
"extraInformation": [],
"hidden": true,
"name": "ElevationLogSpeed"
},
{
"value": "",
"type": "Number",
Expand Down Expand Up @@ -2342,6 +2518,15 @@
"extraInformation": [],
"name": "IsRotatingWithObject"
},
{
"value": "false",
"type": "Boolean",
"label": "Automatically rotate the camera with the object (elevation)",
"description": "",
"group": "",
"extraInformation": [],
"name": "IsElevatingWithObject"
},
{
"value": "0",
"type": "Number",
Expand All @@ -2352,6 +2537,17 @@
"extraInformation": [],
"hidden": true,
"name": "TargetedRotationAngle"
},
{
"value": "0",
"type": "Number",
"unit": "DegreeAngle",
"label": "Targeted camera rotation angle",
"description": "When this angle is set, the camera follow this value instead of the object angle.",
"group": "",
"extraInformation": [],
"hidden": true,
"name": "TargetedElevationAngle"
}
],
"sharedPropertyDescriptors": []
Expand Down