update: 2016/12/14
A. 前置準備
1. 採用 I touchs: Unreal: VR Template 的 A ~ D 步驟, 完成基本專案設置
2. 加入點光源到場景裡:
B. After Game BeginPlay 10 second, Turn Off Light (Set Visibility False)
> Level Blueprint
C. Trigger Volume: Turn Light On / Off
> Level Blueprint
1. Check Property (default is right)
D. Turn On Light to Dark (Intensity = 0)
> Level Blueprint
1. add "Set Intensity" node:
E. Trigger Volume: Timeline Light Up / Down
> Level Blueprint
1. "Timeline_LightIntensity_Up" Node
F. Unreal: OSC Received set Light Intensity
1. Send from Processing:
import oscP5.*;
import netP5.*;
OscP5 oscP5;
NetAddress myRemoteLocation;
int receivePort = 8001;
// osc target
String sendIP = "127.0.0.1";
int sendPort = 8000;
//@add ######
float myIntensity = 0.0;
float maxIntensity = 5000.0;
boolean isUp = true;
void setup() {
size(400, 400);
frameRate(25);
/* start oscP5, listening for incoming messages */
oscP5 = new OscP5(this, receivePort);
myRemoteLocation = new NetAddress(sendIP, sendPort);
}
void draw() {
background(0);
sendOSC();
}
void sendOSC() {
/* in the following different ways of creating osc messages are shown by example */
OscMessage myMessage = new OscMessage("/position");
/* add an float to the osc message */
myMessage.add(myIntensity);
/* send the message */
oscP5.send(myMessage, myRemoteLocation);
// tune Intensity
// light isUp
if (isUp) {
if (myIntensity < maxIntensity) {
myIntensity += 100;
} else {
myIntensity = maxIntensity;
isUp = false;
}
// light isDown
} else {
if (myIntensity > 0.0) {
myIntensity -= 100;
} else {
myIntensity = 0.0;
isUp = true;
}
}
}
2. Receieved from Unreal:
> Level Blueprint
-----------------------------------------------------------------------------------------------
G. Branch Send OSC:
1. Branch Send OSC:
2. Map Branch Send OSC:
-----------------------------------------------------------------------------------------------
H. Depending on The Situation, Send OSC
1. float to integer: Truncate
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。