由用户创建的信息 LukeVideo
17 September 2016 00:35
Hy blend4web heads!
I'm back in my calback adventures !
I am using manfold sensor inspired by petigor tutorials to control a cube.
after that i added a js callback in a node setup to get a function called every second. Because the snake only moves or chanes direction every Xmillisecond
So… I wonder if i could use the JSCALLBACK to trigger a sensor, a pulse or something so that it could help trigger the movement only when the JSCALLBACK has been called. I would prefer not to use a global variable.
Is you want more precision please ask. I am a bit confused and not sure how to explain expose my question
I'm back in my calback adventures !
I am using manfold sensor inspired by petigor tutorials to control a cube.
function setup_direction(){
var head = m_scenes.get_object_by_name("Cube");
var key_up = m_ctl.create_keyboard_sensor(m_ctl.KEY_T);
var key_down = m_ctl.create_keyboard_sensor(m_ctl.KEY_G);
var key_right = m_ctl.create_keyboard_sensor(m_ctl.KEY_H);
var key_left = m_ctl.create_keyboard_sensor(m_ctl.KEY_F);
var direction_array = [
key_up, key_down, key_right, key_left
];
var up_logic = function(s){return (s[0])};
var down_logic = function(s){return (s[1])};
var right_logic = function(s){return (s[2])};
var left_logic = function(s){return (s[3])};
function moveHead_cb(obj, id, pulse, param){
if (pulse == 1){
console.log(id, param);
var head_pos = m_trans.get_translation(obj);
console.log(head_pos);
head_pos[param[0]] += param[1];
console.log(head_pos);
m_trans.set_translation(obj, head_pos[0], head_pos[1], head_pos[2]);
}
else{
console.log("no pulse");
}
};
m_ctl.create_sensor_manifold(head, "UP", m_ctl.CT_TRIGGER,
direction_array, up_logic, moveHead_cb, [2,-1]);
m_ctl.create_sensor_manifold(head, "DOWN", m_ctl.CT_TRIGGER,
direction_array, down_logic, moveHead_cb, [2,1]);
m_ctl.create_sensor_manifold(head, "RIGHT", m_ctl.CT_TRIGGER,
direction_array, right_logic, moveHead_cb, [0,1]);
m_ctl.create_sensor_manifold(head, "LEFT", m_ctl.CT_TRIGGER,
direction_array, left_logic, moveHead_cb, [0,-1]);
}
});
after that i added a js callback in a node setup to get a function called every second. Because the snake only moves or chanes direction every Xmillisecond
function setup_direction(){
m_logic_nodes.append_custom_callback("SNAKEMOVE", snakemove);
var head = m_scenes.get_object_by_name("Cube");
var direction = []
var key_up = m_ctl.create_keyboard_sensor(m_ctl.KEY_T);
var key_down = m_ctl.create_keyboard_sensor(m_ctl.KEY_G);
var key_right = m_ctl.create_keyboard_sensor(m_ctl.KEY_H);
var key_left = m_ctl.create_keyboard_sensor(m_ctl.KEY_F);
var direction_array = [
key_up, key_down, key_right, key_left
];
var up_logic = function(s){return (s[0])};
var down_logic = function(s){return (s[1])};
var right_logic = function(s){return (s[2])};
var left_logic = function(s){return (s[3])};
function moveHead_cb(obj, id, pulse, param){
if (pulse == 1){
console.log(id, param);
var head_pos = m_trans.get_translation(obj);
console.log(head_pos);
head_pos[param[0]] += param[1];
console.log(head_pos);
m_trans.set_translation(obj, head_pos[0], head_pos[1], head_pos[2]);
}
else{
console.log("no pulse");
}
};
function setDirection_cb(obj, id, pulse, param){
//getdirection = getdirection();
console.log(param)//, getdirection);
}
// function getdirection(){
// return true;
// }
m_ctl.create_sensor_manifold(head, "UP", m_ctl.CT_TRIGGER,
direction_array, up_logic, setDirection_cb, [2,-1]);
m_ctl.create_sensor_manifold(head, "DOWN", m_ctl.CT_TRIGGER,
direction_array, down_logic, setDirection_cb, [2,1]);
m_ctl.create_sensor_manifold(head, "RIGHT", m_ctl.CT_TRIGGER,
direction_array, right_logic, setDirection_cb, [0,1]);
m_ctl.create_sensor_manifold(head, "LEFT", m_ctl.CT_TRIGGER,
direction_array, left_logic, setDirection_cb, [0,-1]);
function snakemove() {
console.log("move");
}
}
});
So… I wonder if i could use the JSCALLBACK to trigger a sensor, a pulse or something so that it could help trigger the movement only when the JSCALLBACK has been called. I would prefer not to use a global variable.
Is you want more precision please ask. I am a bit confused and not sure how to explain expose my question
15 August 2016 16:40
13 August 2016 20:25
I'm thinking of using a cms, probably typo 3, for my website I would like to add some webgl and blend4web on some pages. Does anyone have experience with that. I wonder how to export my scenes. Probably like the blog post explains with json and the player.
Another question I have is : is it still possible to use Webgl specifications on witch blend4web is build?
Another question I have is : is it still possible to use Webgl specifications on witch blend4web is build?
06 July 2016 00:47
03 July 2016 23:28
25 June 2016 16:12
24 June 2016 11:09
24 June 2016 00:24
What is your knowledge of blend4web ?
Maybe you could start with a simple node setup I'm which you hide reveal different objects when you click on different objects. That may not be ideal but I could setup a node tree for you in a few minutes. But I suck at materials so I can't help you if you want something more complicated.
Maybe you could start with a simple node setup I'm which you hide reveal different objects when you click on different objects. That may not be ideal but I could setup a node tree for you in a few minutes. But I suck at materials so I can't help you if you want something more complicated.
23 June 2016 12:55
Hello !
Here is a link to a peronnal project.
It's a kind of personnal page. It is still work heavilly in progress. Still have lot to do. But before i continue working on the details I would like to have some of your impression. Just to check if something obvious isn't working… I have been working on this for a couple of weeks and i really can't tell if it's any good.
So if you have any comments. Feel free to reply !
https://lukevideo.github.io/LukeVideoLowPoly.html
Here is a link to a peronnal project.
It's a kind of personnal page. It is still work heavilly in progress. Still have lot to do. But before i continue working on the details I would like to have some of your impression. Just to check if something obvious isn't working… I have been working on this for a couple of weeks and i really can't tell if it's any good.
So if you have any comments. Feel free to reply !
https://lukevideo.github.io/LukeVideoLowPoly.html