- Code: Select all
FlybyCam2:
camera:
animated: 1
brain:
xpanlimit: 0
zpanlimit: 0
type: simple
flags:
- cutpos
- cutpoa
animations:
- name: FlybyCam2
autostart: 0
loop: 0
logic:
actions:
- type: responder #this responder is triggered by the first modifier on the region, it starts the animation and sets the camera
name: FlybyCam2
responder:
states:
- cmds:
- type: timercallbackmsg
params:
receivers:
- respondermod:FlybyCam2
id: 0
time: 2.0
- type: animcmdmsg
params:
receivers:
- 006D:FlybyCam2
animname: FlybyCam2
cmds:
- setbegin
- continue
waiton: 0
- type: cameramsg
params:
cmds:
- regionpushcamera
- respondertrigger
newcam: FlybyCam2
waiton: -1
nextstate: 1
waittocmd:
- key: 0
msg: 0
FlybyCamRegion:
logic:
modifiers:
- name: EnterFlyby #this modifier triggers the responder FlybyCam2 on entering the region (see direction: enter)
flags:
- multitrigger
activators:
- type: objectinvolume
conditions:
- type: volumesensor
satisfied: true
direction: enter
actions:
- type: responder
ref: :FlybyCam2
- name: ExitFlyby #this modifier triggers the responder PopFlyby on exiting the region (see direction: exit)
flags:
- multitrigger
activators:
- type: objectinvolume
conditions:
- type: volumesensor
satisfied: true
direction: exit
actions:
- type: responder
ref: :PopFlyby
actions:
- type: responder #this responder disables the modifiers on this region (the enablemsg) and returns camera control to another camera
name: PopFlyby
responder:
states:
- cmds:
- type: cameramsg
params:
cmds:
- regionpushcamera
- respondertrigger
- setasprimary
newcam: IndoorAvCam
waiton: -1
- type: enablemsg
params:
receivers:
- 002D:EnterFlyby
- 002D:ExitFlyby
cmds:
- disable
waiton: -1
nextstate: 1
waittocmd: 0
The blender object "FlybyCamRegion" is a region surrounding the link in point, when the "EnterFlyBy" modifier is triggered, it runs the "FlybyCam2" responder in "FlybyCam2".
The blender object FlybyCam2 is a camera which has been animated, meaning I dragged it around and set keyframes for it. The animation settings can be seen on the object, as well as it's camera brain, which is a 'simple' with 0 pan and cutpos and cutpoa enabled. It contains the definition for the responder (which is called by the region enter modifier) which sends a message to activate the animation, and a camera message that forces the animated camera to be used. (the timercallback is just to delay the start of the animation)
Back to the region object, there is a second modifier, which triggers on exit. "ExitFlyby" triggers the "PopFlyby" responder, which uses another camera message to return the camera to normal (or rather, to another defined camera which I didn't include, it's a standard avatar following cam) and sends an enablemsg to both of the modifiers (EnterFlyby and ExitFlyby) on the region, disabling them so they won't be activated later, if the avatar reenters the region.