-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from defold/camera-update
Update to use new camera api
- Loading branch information
Showing
4 changed files
with
10 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,13 @@ | ||
function init(self) | ||
msg.post("#camera", "acquire_camera_focus") -- <1> | ||
msg.post("@render:", "use_camera_projection") -- <2> | ||
end | ||
|
||
function on_message(self, message_id, message, sender) | ||
if message_id == hash("follow") then -- <3> | ||
go.set_parent(".", sender) -- <4> | ||
elseif message_id == hash("unfollow") then -- <5> | ||
if message_id == hash("follow") then -- <1> | ||
go.set_parent(".", sender) -- <2> | ||
elseif message_id == hash("unfollow") then -- <3> | ||
go.set_parent("camera", nil, true) | ||
end | ||
end | ||
|
||
--[[ | ||
1. Acquire camera focus for the camera component. When a camera has focus it will send view and projection updates to the render script. | ||
2. Tell the render script to use the view and projection provided by the camera. | ||
3. Start following the game object that sent the `follow` message. | ||
4. This is done by parenting the camera component to the game object that sent the message. | ||
5. Stop following any game object. This is done removing the parent game object while maintaining the current world transform. | ||
1. Start following the game object that sent the `follow` message. | ||
2. This is done by parenting the camera component to the game object that sent the message. | ||
3. Stop following any game object. This is done removing the parent game object while maintaining the current world transform. | ||
--]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters