Forum

User posts Mike
07 November 2016 20:46
4) assume that the solution must be transportable. In one of the examples I noticed that if you are in a static room and you know the x,y co-ordinates of every wall are unchanging then you can write code based on the current camera location. In my case i don't want to have to code in the location of every wall on every level.
07 November 2016 20:41
Hi Evgeny,

I've run into this issue on a couple of occasions:
this was the other attempt
https://www.blend4web.com/en/forums/topic/2293/

When controlling a Player / Character but not using the 'Character' checkbox on the physics panel there is no way to rotate the character.

would it not be as simple as allowing
m_phy.character_rotation_inc(obj, h_angle, v_angle) to work even if the 'Character' checkbox is off?

when 'Character' box is checked the ability to modify physics.gravity(X) is also removed.

I'm really just asking for an update, do you have an idea of when this ability may be added in a future release?

thanks!
05 November 2016 16:42
Ok first off, thanks for the example..That will actually come in handy!
I didn't do a great job explaining what I'm looking for.

Talking about making a game:
1) player is in the center of the screen (0,0,1).
1a) There is an Empty parented to the player around the head area.
2) B4W camera (Type: Eye) is at (0,-20,4).
2a) The camera is appended to the Empty append_semi_soft_cam
3) I use the mouse to rotate the character and in turn the camera follows the players movment. The camera also moves up and down following the mouse movement.

so my question was supposed to be this:
In my game world I have walls and objects and a floor and I would like to know how to make the camera collide with these things instead of going right through them.
I've applied all manners of different solutions but nothing seems to work, camera does not collide.

Thanks again Tamas for the response anyways! Hope my new description makes more sense.
04 November 2016 05:59
Hello All!

I have an Eye camera in 3rd person view. I would like to apply something to the camera so that it can not go through floors and walls.

is there an example of this? I tried all physics types and i've tried parenting the camera to an object and applying the same options, nothing seems to work.

pls help!

Thanks!
02 November 2016 21:06
The solution I found.. add a simple cube. add a material.
In the physics panel leave collision ID: <blank>
In physics panel check the 'ghost' box
In the material panel at the bottom select 'special collision' and again check 'ghost'
in the material panel under 'special collision' using the example above enter in 'FLOOR' in the Collision ID.
If you want to hide the object that is being collided with go to 'object' panel and check the 'do not render' checkbox under render settings.

So interestingly, the collision object still interacts with the character object, even if it's invisible you can still stand on it as ghost.

Also, I found that changing the dimensions of the cube (even with CTRL S, Apply Scale) cause the interaction with the collision to be a little finicky.
On the Blend4Web tab on the toolshelf (hotkey t) there is an option to manually set the collision bounds of the object. Some adjustment to my character capsule and the object with the special collision material helped to get it working consistently.
02 November 2016 20:59
for my case, stick with
m_phy.character_rotation_inc(obj, h_angle, v_angle)
to rotate character.

I read that there may be physics movement added to the logic node system, that may help this situation in the future.
02 November 2016 20:56
Ah, I see. This is the API version of viewport allignment
https://www.blend4web.com/doc/en/camera.html#viewport-alignment

Used to make HUD by attaching objects to the camera. I was actually thinking I was appending the camera to a character.. not so.
27 October 2016 18:00
This is exactly what I'm looking for, for a 2d game ;)
Attach the object to the camera using a stiff vieport constraint, so the child object will preserve its orientation in the camera viewport. This constraint is used to create onscreen 2D/3D user interfaces.

append_stiff_viewport(obj, camobj, positioning)

But how do I create this object?
StiffViewportPositioning
left Number
right Number
top Number
bottom Number
distance Number
etc.
etc.

could someone provide an example?

Thanks
Mike
27 October 2016 17:54
Thanks for the reply , I know you guys are busy ! :) your great support is always appreciated regardless of how long it takes.

So the real problem is that there is no way to rotate an object using physics. Torque doesn't do anything, at least not for my scenario.

I've tried the physics.set_transform method as you suggested (it's the only option) and it does what I want physically however it's not useable.

Since the method requires both a transform and a quat rotation when I use this method to update my rotation it causes terrible jittering.
set_transform(obj, trans, quat)

It seems that by the time the set.transform method is activated the location the trans is outdated.
maybe I've tried to many different ways to get it working and now I'm just making a mistake.

I can send you an example file direct but I'd rather not post in the forum. Once I figure it out (hopefully with your help when you have time) I can post the results in the forum in case anyone else is having the same problem.) I really dislike dead end forum posts ;).

thanks!!! and thanks for the hard work on B4W, it's great!
27 October 2016 03:12
I thought I found what I was looking for here:
https://www.blend4web.com/en/forums/topic/1052/

var cube = m_scenes.get_object_by_name("Cube");
m_transform.rotate_y_local(cube, angle);

var trans = m_transform.get_translation(cube);

m_transform.set_translation(cube, trans)

I think this function needs to be extended to the API?
m_trans.update_transform(cube);

m_physics.sync_transform(cube);

I've tried all different methods of transforms and the m_physics.sync_tranform(obj) does not work?

Evgeny Rodygin please help!! ;)