User posts sdc44
30 October 2015 17:02
Also you can extract the camera rotation quaternion and convert one of the camera local axes to a world space to calculate the direction of desirable moving:

var quat = transform.get_rotation(cam, _vec4_tmp);
var z_world_cam = util.quat_to_dir(quat, m_util.AXIS_Z, _vec3_tmp);

What do you mean by this, doing this i get a vector, and im assuming its the directional vector the camera is pointing, but from this how do i know when i click a direction, which direction to translate on?
26 October 2015 18:31
im doing the copying and translations using javascript. i want to create a generic object that has a annotation associated to it, when i copy and move that object i want to be able to access the anchor and change the name. My problem is i cant copy and translate an empty, and i cannot assign an anchor to an object. I have tried creating an object and an empty and parenting them together but this does not seem to work.
26 October 2015 16:43
also is there a way that i can tell which way the camera is facing and than move the camera left/right/forward/back relative to that, i understand how to move the camera using
m_cam.translate_hover_cam_v(camera, pos);
But if the camera rotates how do i know which direction to move the camera left?
26 October 2015 16:06
Thanks i ended up using the controls you talked about. Is there anyway to make the movement not so choppy, i provided the interface to move in increments like i wanted, but i was hoping to make the camera move smoothly to the new point,
20 October 2015 21:00
i was wonder if it was possible to control the camera using buttons on the canvas, i want to create a set of controls. left right up down in out, that when a user clicks simulate moving a hover camera. for example left would do the same as left button, up same as up bottom, and in same as mousewheel in. i tried using the move_local but it doesn't work the same, any ideas?
20 October 2015 16:28
Yeah, turns out it doesn't do what i was hoping it would, i would like to be able to attach an anchor to an object, that way whenever i copy and translate my object i can move the tag with it.
19 October 2015 21:41
i was looking at the custom anchors example specific adding a generic anchor. I am using the same code that you provided, but with my own object, and the attach_move_cb callback function is never hit. I am assuming there is some setting within blender that is needed but not sure what. Any Ideas?

var obj = m_scs.get_object_by_name("obj");

var cyl_text = document.createElement("span"); = "cyl_anchor"; = "absolute"; = "yellow"; = "black"; = "5px";
cyl_text.innerHTML = "Cylinder (Generic)";

m_anchors.attach_move_cb(obj, function (x, y, appearance, obj, elem) {
var anchor_elem = document.getElementById("cyl_anchor"); = x + "px"; = y + "px";

if (appearance == "visible") = "visible";
else = "hidden";
16 October 2015 18:57
I think i figured it out, in the example, the camera needs to have physics applied to it
16 October 2015 18:29
Hi I am trying to use your raytest example and apply my own scene to it. However i get an error when i get to

var id = m_phy.append_ray_test_ext(obj_src, from, to, "ANY", ray_test_cb, true, false, true, true);.

It appears the b4w.min is looking for a body_id in my to object(which is just a float32array.. the console error is

Uncaught TypeError: Cannot read property 'body_id' of null
16 October 2015 18:26
Sorry, i looked a little more and came across the answer in the forums