www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started by: CarlosMB89 on June 27, 2015, 01:01:01 pm
-
Hello
I was developing an app for Android with JPCT and I would like to change the height of a cylinder dinamically.
Would it be possible? Because I didn't found any method to do that.
Thanks in advance.
-
The simplest way to do that, is by multiplying the object's rotation matrix with a none-uniform scaling matrix. Something like
Matrix m=new Matrix();
m.set(1,1,2f);
cylinder.getRotation().matMul(m);
However, this affects lighting in a way that might look strange. Just give it a try and see if it's sufficient. If it's not, please report back here and we'll find another solution.
-
Hello Egon, I tried it but the height doesn't change. It has no effect. What could I do then??
Thank you
-
Please double check your code. I don't see any reason why it shouldn't work, unless you are doing something the the objects rotation matrix afterwards.
-
Ok, sorry, I fixed it. The problem was as you said thai I changed the orientation of the object before.
But I still have a problem about the light as you said as well.
When the object grows in the oposite direction, the lights of the object turns off. It has no illumination. How can I fix it?
Thank you
-
What do you mean by 'opposite direction' in this case?
-
This means that my cylinder grows along the positive X axis and then it grows about the negative X axis, but when it grows this way the lights turn off....
-
Yes, because that will invert the normals...I'll try to figure something out...
-
Why does it actually grow along the negative axis? Are you using a negative scale? If that's the case, try to add this:
cyl.invertCulling(scale < 0);
If that's not the case, then I'm not sure if I understand the problem correctly...
-
BTW: Please fix your mail address. I'm getting bounces with "user unknown" each time the forum system tries to send a mail to you.