Example: /Mac64bit/SceneKit/Camera

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/Mac64bit/SceneKit/Camera


Required plugins for this example: MBS Mac64bit Plugin, MBS MacBase Plugin, MBS MacCG Plugin, MBS Main Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Mac64bit/SceneKit/Camera

This example is the version from Tue, 4th May 2020.

Project "Camera.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Mapp Inherits SCNControlMBS
ControlInstance Mapp Inherits SCNControlMBS
EventHandler Sub Open() MyView = Me.View MyScene = New SCNSceneMBS MyView.scene = MyScene myView.autoenablesDefaultLighting = True MyCamera = New SCNCameraMBS CameraNode = New SCNNodeMBS CameraNode.Camera = MyCamera CameraNode.Position = New SCNVector3MBS(0, 0, 7) MyCamera.zNear = 0.7 MyCamera.zFar = 23 myview.pointOfView = CameraNode MyView.allowsCameraControl = True myView.backgroundColor = NSColorMBS.blackColor Rotate90Degree End EventHandler
End Control
Control Top Inherits PushButton
ControlInstance Top Inherits PushButton
EventHandler Sub Action() // Set the Point of view on the top CameraNode.Position = New SCNVector3MBS(0, 7, 0) CameraNode.EulerAngles = New SCNVector3MBS(4.71239, 0, 0) myview.pointOfView = CameraNode myview.play End EventHandler
End Control
Control left Inherits PushButton
ControlInstance left Inherits PushButton
EventHandler Sub Action() // Set the Point of view on the left side CameraNode.Position = New SCNVector3MBS(7, 0, 0) CameraNode.EulerAngles = New SCNVector3MBS(0, 1.5708, 0) myview.pointOfView = CameraNode myview.play End EventHandler
End Control
Control right Inherits PushButton
ControlInstance right Inherits PushButton
EventHandler Sub Action() // Set the Point of view on the right side CameraNode.Position = New SCNVector3MBS(-7, 0, 0) CameraNode.EulerAngles = New SCNVector3MBS(0, 4.71239, 0) myview.pointOfView = CameraNode myview.play End EventHandler
End Control
Control Front Inherits PushButton
ControlInstance Front Inherits PushButton
EventHandler Sub Action() // Set the Point of view on the front CameraNode.Position = New SCNVector3MBS(0, 0, 7) CameraNode.EulerAngles = New SCNVector3MBS(0, 0, 0) myview.pointOfView = CameraNode myview.play End EventHandler
End Control
Control CameraControlCheck Inherits CheckBox
ControlInstance CameraControlCheck Inherits CheckBox
EventHandler Sub Action() MyView.allowsCameraControl = Me.value End EventHandler
End Control
Sub Rotate90Degree() //Add the Node to the Scene Dim NodeOneGeometry As New SCNPyramidMBS(1, 1, 1) Dim NodeOne As New SCNNodeMBS(NodeOneGeometry) NodeOneGeometry.firstMaterial.diffuse.contents = NSColorMBS.purpleColor NodeOne.Position = New SCNVector3MBS(0, 0, 0) MyScene.rootNode.addChildNode(NodeOne) //The angle must be given as radians //Convert: angleDegree*(Pi/180) Dim angleDegree As Double = 90 Const Pi = 3.14159265358979323846264338327950 Dim angleRad As Double angleRad = angleDegree * (Pi / 180) //create the movements Dim rotate90 As SCNActionMBS = SCNActionMBS.rotateBy(angleRad, 0, 0, 2) Dim moveBy As SCNActionMBS = SCNActionMBS.moveBy(1, 0, 0, 1) Dim pos As New SCNVector3MBS(0, 0, 0) Dim moveTo As SCNActionMBS = SCNActionMBS.moveTo(pos, 1) Dim sequence As SCNActionMBS = SCNActionMBS.sequence(Array (rotate90, moveBy, moveTo)) Dim repeat As SCNActionMBS = SCNActionMBS.repeatActionForever(sequence) NodeOne.runAction(repeat) End Sub
Property CameraNode As SCNNodeMBS
Property MyCamera As SCNCameraMBS
Property MyScene As SCNSceneMBS
Property MyView As SCNViewMBS
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

The items on this page are in the following plugins: MBS Mac64bit Plugin.


💬 Ask a question or report a problem