Bonzai Engine Forum

Bonzai Engine & Tools => Bonzai Engine on Android => Topic started by: Peter Yeremenko on June 22, 2012, 03:30:53 PM

Title: Model rotating when projection matrix and model view matrices are used
Post by: Peter Yeremenko on June 22, 2012, 03:30:53 PM
I'm developing augmented reality application using Qualcomm QCAR framework. For correct displaying of the object I use model view matrix and projection matrix provided by QCAR.

I'm using these matrices like listed below:

Everything is ok, but I need to rotate the model. Is there any method like model.setRotationX(angle) in Bonzai or I need to multiply my modelViewMatrix on another rotation matrix. I am afraid that when modelViewMatrix will be multiplied by the rotation matrix, model will rotate about the origin, and not about the center of the model.

Please explain me, how can the model be rotated about it's center.
Title: Re: Model rotating when projection matrix and model view matrices are used
Post by: Peter Yeremenko on June 22, 2012, 03:58:27 PM
And one more question

I've loaded flower_6.fbx model from models pack (http://dexsoft-games.com/models/medieval_free.html) that been advised in neighbour thread.

But branches of plant displayed without transparency. Bonzai editor have transparency flag which makes every branch of plant transparent. So, how can I do the same using bonzai?
Title: Re: Model rotating when projection matrix and model view matrices are used
Post by: jerome_j on June 22, 2012, 04:09:54 PM
You can position a model using a Transform object (which can be created from a matrix if needed).
The model origin is not always it's center, so you'll have to use it's bounding box to find it's center and rotate from that point. Bounding box is accessible from in Model using getBoundingVolume (search in tutorials which uses that).

Quote
But branches of plant displayed without transparency. Bonzai editor have transparency flag which makes every branch of plant transparent. So, how can I do the same using bonzai?
To force using alpha channel of diffuse texture as transparency on all materials, use the following:
You can also do it per material using methods in Material object.
Title: Re: Model rotating when projection matrix and model view matrices are used
Post by: Peter Yeremenko on June 23, 2012, 07:27:08 AM
Thank you a lot! It works fine.