Author Topic: Model rotating when projection matrix and model view matrices are used  (Read 4287 times)

Peter Yeremenko

  • Jr. Member
  • **
  • Posts: 9
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.

Peter Yeremenko

  • Jr. Member
  • **
  • Posts: 9
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?

jerome_j

  • Administrator
  • *****
  • Posts: 116
    • Bonzai Engine
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.
« Last Edit: June 22, 2012, 04:12:45 PM by jerome_j »

Peter Yeremenko

  • Jr. Member
  • **
  • Posts: 9
Thank you a lot! It works fine.