Skip to content

Commit b61b3f4

Browse files
committed
[Reviewed] [3rd person camera] Allow to smooth the elevation angle
1 parent ec1fa58 commit b61b3f4

1 file changed

Lines changed: 204 additions & 8 deletions

File tree

extensions/reviewed/ThirdPersonCamera.json

Lines changed: 204 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"author": "",
33
"category": "Camera",
44
"extensionNamespace": "",
5-
"gdevelopVersion": ">=5.5.222",
65
"fullName": "Third person camera",
6+
"gdevelopVersion": ">=5.5.222",
77
"helpPath": "",
88
"iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlnb24gY2xhc3M9InN0MCIgcG9pbnRzPSI3LDEwIDEsMTMgNywxNiAxMywxMyAiLz4NCjxwb2x5bGluZSBjbGFzcz0ic3QwIiBwb2ludHM9IjEsMTMgMSwyMCA3LDIzIDEzLDIwIDEzLDEzICIvPg0KPGxpbmUgY2xhc3M9InN0MCIgeDE9IjciIHkxPSIxNiIgeDI9IjciIHkyPSIyMyIvPg0KPGxpbmUgY2xhc3M9InN0MCIgeDE9IjMxIiB5MT0iMTYiIHgyPSIyMSIgeTI9IjgiLz4NCjxsaW5lIGNsYXNzPSJzdDAiIHgxPSIyMSIgeTE9IjI0IiB4Mj0iMzEiIHkyPSIxNiIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTIyLjcsMjIuNkMyMCwyMS43LDE4LDE5LjEsMTgsMTZjMC0zLjEsMi01LjcsNC43LTYuNiIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTE5LjgsMTEuM2MxLjQsMS4xLDIuMiwyLjgsMi4yLDQuN2MwLDEuOS0wLjksMy42LTIuMiw0LjciLz4NCjwvc3ZnPg0K",
99
"name": "ThirdPersonCamera",
1010
"previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Virtual Reality/94e95d2c318e1f3dc7151a351024e13c574e1e44669c6696aa107d60230073f6_Virtual Reality_3d_vision_eye_vr.svg",
1111
"shortDescription": "Move the camera to look at an object from a given distance.",
12-
"version": "1.6.1",
12+
"version": "1.7.0",
1313
"description": [
1414
"Move the camera to look at an object from a given distance with a rotation and an elevation angles.",
1515
"",
@@ -583,6 +583,18 @@
583583
""
584584
]
585585
},
586+
{
587+
"type": {
588+
"value": "ThirdPersonCamera::ThirdPersonCamera::SetElevationHalfwayDuration"
589+
},
590+
"parameters": [
591+
"Object",
592+
"Behavior",
593+
"=",
594+
"ElevationHalfwayDuration",
595+
""
596+
]
597+
},
586598
{
587599
"type": {
588600
"value": "ThirdPersonCamera::ThirdPersonCamera::SetTranslationZHalfwayDuration"
@@ -912,6 +924,33 @@
912924
}
913925
]
914926
},
927+
{
928+
"type": "BuiltinCommonInstructions::Standard",
929+
"conditions": [
930+
{
931+
"type": {
932+
"value": "BooleanVariable"
933+
},
934+
"parameters": [
935+
"IsElevatingWithObject",
936+
"True",
937+
""
938+
]
939+
}
940+
],
941+
"actions": [
942+
{
943+
"type": {
944+
"value": "SetNumberVariable"
945+
},
946+
"parameters": [
947+
"TargetedElevationAngle",
948+
"=",
949+
"Object.Object3D::RotationY()"
950+
]
951+
}
952+
]
953+
},
915954
{
916955
"type": "BuiltinCommonInstructions::Standard",
917956
"conditions": [],
@@ -921,23 +960,33 @@
921960
"value": "SetNumberVariable"
922961
},
923962
"parameters": [
924-
"CameraAngle",
963+
"CameraRotationAngle",
925964
"=",
926965
"TargetedRotationAngle + 90 + RotationAngleOffset + AngleDifference(CameraAngle(Object.Layer()), TargetedRotationAngle + 90 + RotationAngleOffset) * exp(TimeDelta() * RotationLogSpeed)"
927966
]
928967
},
968+
{
969+
"type": {
970+
"value": "SetNumberVariable"
971+
},
972+
"parameters": [
973+
"CameraElevationAngle",
974+
"=",
975+
"TargetedElevationAngle + ElevationAngleOffset + AngleDifference(90 - Scene3D::CameraRotationX(Object.Layer()), TargetedElevationAngle + ElevationAngleOffset) * exp(TimeDelta() * ElevationLogSpeed)"
976+
]
977+
},
929978
{
930979
"type": {
931980
"value": "ThirdPersonCamera::LookFromDistanceAtPosition3D"
932981
},
933982
"parameters": [
934983
"",
935-
"Object.CenterX() + ThirdPersonCamera::RotatedX(CameraAngle, OffsetX, -OffsetY)",
936-
"Object.CenterY() + ThirdPersonCamera::RotatedY(CameraAngle, OffsetX, -OffsetY)",
984+
"Object.CenterX() + ThirdPersonCamera::RotatedX(CameraRotationAngle, OffsetX, -OffsetY)",
985+
"Object.CenterY() + ThirdPersonCamera::RotatedY(CameraRotationAngle, OffsetX, -OffsetY)",
937986
"CameraZ + OffsetZ",
938987
"Distance",
939-
"CameraAngle",
940-
"Object.Object3D::RotationY() + ElevationAngleOffset",
988+
"CameraRotationAngle",
989+
"CameraElevationAngle",
941990
"",
942991
""
943992
]
@@ -946,7 +995,12 @@
946995
"variables": [
947996
{
948997
"folded": true,
949-
"name": "CameraAngle",
998+
"name": "CameraRotationAngle",
999+
"type": "number",
1000+
"value": 0
1001+
},
1002+
{
1003+
"name": "CameraElevationAngle",
9501004
"type": "number",
9511005
"value": 0
9521006
}
@@ -1251,6 +1305,108 @@
12511305
],
12521306
"objectGroups": []
12531307
},
1308+
{
1309+
"description": "the halfway time for elevation rotation of the object.",
1310+
"fullName": "Halfway time for elevation rotation",
1311+
"functionType": "ExpressionAndCondition",
1312+
"group": "Third person camera configuration",
1313+
"name": "ElevationHalfwayDuration",
1314+
"sentence": "the halfway time for elevation rotation",
1315+
"events": [
1316+
{
1317+
"type": "BuiltinCommonInstructions::Standard",
1318+
"conditions": [],
1319+
"actions": [
1320+
{
1321+
"type": {
1322+
"value": "SetReturnNumber"
1323+
},
1324+
"parameters": [
1325+
"ElevationHalfwayDuration"
1326+
]
1327+
}
1328+
]
1329+
}
1330+
],
1331+
"expressionType": {
1332+
"type": "expression"
1333+
},
1334+
"parameters": [
1335+
{
1336+
"description": "Object",
1337+
"name": "Object",
1338+
"type": "object"
1339+
},
1340+
{
1341+
"description": "Behavior",
1342+
"name": "Behavior",
1343+
"supplementaryInformation": "ThirdPersonCamera::ThirdPersonCamera",
1344+
"type": "behavior"
1345+
}
1346+
],
1347+
"objectGroups": []
1348+
},
1349+
{
1350+
"fullName": "",
1351+
"functionType": "ActionWithOperator",
1352+
"getterName": "ElevationHalfwayDuration",
1353+
"name": "SetElevationHalfwayDuration",
1354+
"sentence": "",
1355+
"events": [
1356+
{
1357+
"type": "BuiltinCommonInstructions::Comment",
1358+
"color": {
1359+
"b": 109,
1360+
"g": 230,
1361+
"r": 255,
1362+
"textB": 0,
1363+
"textG": 0,
1364+
"textR": 0
1365+
},
1366+
"comment": "ln((1 - speed)) = ln(1 / 2) / halfwatTime"
1367+
},
1368+
{
1369+
"type": "BuiltinCommonInstructions::Standard",
1370+
"conditions": [],
1371+
"actions": [
1372+
{
1373+
"type": {
1374+
"value": "SetNumberVariable"
1375+
},
1376+
"parameters": [
1377+
"ElevationHalfwayDuration",
1378+
"=",
1379+
"Value"
1380+
]
1381+
},
1382+
{
1383+
"type": {
1384+
"value": "SetNumberVariable"
1385+
},
1386+
"parameters": [
1387+
"ElevationLogSpeed",
1388+
"=",
1389+
"log(0.5) / Value"
1390+
]
1391+
}
1392+
]
1393+
}
1394+
],
1395+
"parameters": [
1396+
{
1397+
"description": "Object",
1398+
"name": "Object",
1399+
"type": "object"
1400+
},
1401+
{
1402+
"description": "Behavior",
1403+
"name": "Behavior",
1404+
"supplementaryInformation": "ThirdPersonCamera::ThirdPersonCamera",
1405+
"type": "behavior"
1406+
}
1407+
],
1408+
"objectGroups": []
1409+
},
12541410
{
12551411
"description": "the halfway time on Z axis of the object.",
12561412
"fullName": "Halfway time on Z axis",
@@ -2190,6 +2346,16 @@
21902346
"extraInformation": [],
21912347
"name": "RotationHalfwayDuration"
21922348
},
2349+
{
2350+
"value": "0",
2351+
"type": "Number",
2352+
"unit": "Second",
2353+
"label": "Halfway time for elevation rotation",
2354+
"description": "",
2355+
"group": "Catch-up speed",
2356+
"extraInformation": [],
2357+
"name": "ElevationHalfwayDuration"
2358+
},
21932359
{
21942360
"value": "0.125",
21952361
"type": "Number",
@@ -2292,6 +2458,16 @@
22922458
"hidden": true,
22932459
"name": "RotationLogSpeed"
22942460
},
2461+
{
2462+
"value": "",
2463+
"type": "Number",
2464+
"label": "",
2465+
"description": "",
2466+
"group": "",
2467+
"extraInformation": [],
2468+
"hidden": true,
2469+
"name": "ElevationLogSpeed"
2470+
},
22952471
{
22962472
"value": "",
22972473
"type": "Number",
@@ -2342,6 +2518,15 @@
23422518
"extraInformation": [],
23432519
"name": "IsRotatingWithObject"
23442520
},
2521+
{
2522+
"value": "false",
2523+
"type": "Boolean",
2524+
"label": "Automatically rotate the camera with the object (elevation)",
2525+
"description": "",
2526+
"group": "",
2527+
"extraInformation": [],
2528+
"name": "IsElevatingWithObject"
2529+
},
23452530
{
23462531
"value": "0",
23472532
"type": "Number",
@@ -2352,6 +2537,17 @@
23522537
"extraInformation": [],
23532538
"hidden": true,
23542539
"name": "TargetedRotationAngle"
2540+
},
2541+
{
2542+
"value": "0",
2543+
"type": "Number",
2544+
"unit": "DegreeAngle",
2545+
"label": "Targeted camera rotation angle",
2546+
"description": "When this angle is set, the camera follow this value instead of the object angle.",
2547+
"group": "",
2548+
"extraInformation": [],
2549+
"hidden": true,
2550+
"name": "TargetedElevationAngle"
23552551
}
23562552
],
23572553
"sharedPropertyDescriptors": []

0 commit comments

Comments
 (0)