Skip to content

Commit

Permalink
[Reviewed] [Third person camera] Use object Z position (#1049)
Browse files Browse the repository at this point in the history
* Handle extreme elevation angles
  • Loading branch information
D8H authored Oct 12, 2023
1 parent c58a94c commit da43a68
Showing 1 changed file with 200 additions and 4 deletions.
204 changes: 200 additions & 4 deletions extensions/reviewed/ThirdPersonCamera.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@
"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.0.0",
"version": "1.1.0",
"description": [
"Move the camera to look at an object from a given distance with a rotation and an elevation angles.",
"",
"It can be useful for:",
"- Third person camera",
"- Isometric view",
"- Isometric-like point of view",
""
],
"origin": {
"identifier": "ThirdPersonCamera",
"name": "gdevelop-extension-store"
},
"tags": [
"3d",
"camera"
Expand All @@ -28,9 +32,10 @@
"eventsFunctions": [
{
"description": "Move the camera to look at a position from a distance.",
"fullName": "Look at a position from a distance",
"fullName": "Look at a position from a distance (deprecated)",
"functionType": "Action",
"name": "LookFromDistanceAtPosition",
"private": true,
"sentence": "Move the camera of _PARAM6_ to look at _PARAM1_; _PARAM2_ from _PARAM3_ pixels with a rotation of _PARAM4_° and an elevation of _PARAM5_°",
"events": [
{
Expand Down Expand Up @@ -126,9 +131,10 @@
},
{
"description": "Move the camera to look at an object from a distance.",
"fullName": "Look at an object from a distance",
"fullName": "Look at an object from a distance (deprecated)",
"functionType": "Action",
"name": "LookFromDistanceAtObject",
"private": true,
"sentence": "Move the camera of _PARAM5_ to look at _PARAM1_ from _PARAM2_ pixels with a rotation of _PARAM3_° and an elevation of _PARAM4_°",
"events": [
{
Expand Down Expand Up @@ -181,6 +187,196 @@
}
],
"objectGroups": []
},
{
"description": "Move the camera to look at a position from a distance.",
"fullName": "Look at a position from a distance",
"functionType": "Action",
"name": "LookFromDistanceAtPosition3D",
"sentence": "Move the camera of _PARAM7_ to look at _PARAM1_; _PARAM2_; _PARAM3_ from _PARAM4_ pixels with a rotation of _PARAM5_° and an elevation of _PARAM6_°",
"events": [
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
"actions": [
{
"type": {
"value": "SetCameraCenterX"
},
"parameters": [
"",
"=",
"PositionX + Distance * cos(ToRad(RotationAngle + 90)) * cos(ToRad(ElevationAngle))",
"Layer",
""
]
},
{
"type": {
"value": "SetCameraCenterY"
},
"parameters": [
"",
"=",
"PositionY + Distance * sin(ToRad(RotationAngle + 90)) * cos(ToRad(ElevationAngle))",
"Layer",
""
]
},
{
"type": {
"value": "Scene3D::SetCameraZ"
},
"parameters": [
"",
"=",
"PositionZ + Distance * sin(ToRad(ElevationAngle))",
"Layer",
""
]
},
{
"type": {
"value": "Scene3D::SetCameraRotationX"
},
"parameters": [
"",
"=",
"90 - ElevationAngle",
"Layer",
""
]
},
{
"type": {
"value": "Scene3D::SetCameraRotationY"
},
"parameters": [
"",
"=",
"0",
"Layer",
""
]
},
{
"type": {
"value": "SetCameraAngle"
},
"parameters": [
"",
"=",
"RotationAngle",
"Layer",
""
]
}
]
}
],
"parameters": [
{
"description": "Position on X axis",
"name": "PositionX",
"type": "expression"
},
{
"description": "Position on Y axis",
"name": "PositionY",
"type": "expression"
},
{
"description": "Position on Z axis",
"name": "PositionZ",
"type": "expression"
},
{
"description": "Distance",
"name": "Distance",
"type": "expression"
},
{
"description": "Rotation angle (around Z axis)",
"name": "RotationAngle",
"type": "expression"
},
{
"description": "Elevation angle (around Y axis)",
"name": "ElevationAngle",
"type": "expression"
},
{
"description": "Layer",
"name": "Layer",
"type": "layer"
}
],
"objectGroups": []
},
{
"description": "Move the camera to look at an object from a distance.",
"fullName": "Look at an object from a distance",
"functionType": "Action",
"name": "LookFromDistanceAtObject3D",
"sentence": "Move the camera of _PARAM6_ to look at _PARAM1_ from _PARAM3_ pixels with a rotation of _PARAM4_° and an elevation of _PARAM5_°",
"events": [
{
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
"actions": [
{
"type": {
"value": "ThirdPersonCamera::LookFromDistanceAtPosition3D"
},
"parameters": [
"",
"Object.CenterX()",
"Object.CenterY()",
"Object.Object3D::CenterZ()",
"Distance",
"RotationAngle",
"ElevationAngle",
"Layer",
""
]
}
]
}
],
"parameters": [
{
"description": "Object",
"name": "Object",
"type": "objectList"
},
{
"description": "3D capability",
"name": "Object3D",
"supplementaryInformation": "Scene3D::Base3DBehavior",
"type": "behavior"
},
{
"description": "Distance",
"name": "Distance",
"type": "expression"
},
{
"description": "Rotation angle (around Z axis)",
"name": "RotationAngle",
"type": "expression"
},
{
"description": "Elevation angle (around Y axis)",
"name": "ElevationAngle",
"type": "expression"
},
{
"description": "Layer",
"name": "Layer",
"type": "layer"
}
],
"objectGroups": []
}
],
"eventsBasedBehaviors": [],
Expand Down

0 comments on commit da43a68

Please sign in to comment.