Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Search
Login
Register
www.jpct.net
»
jPCT-AE - a 3d engine for Android
»
Support
»
Animating a object
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Animating a object (Read 1898 times)
tejas87
byte
Posts: 1
Animating a object
«
on:
July 02, 2013, 01:39:25 pm »
Hello, I have a 3d object in a wheel shape and I want to spin it on touch. How can I achieve this.
Logged
Wolf17
int
Posts: 77
Re: Animating a object
«
Reply #1 on:
July 02, 2013, 04:55:46 pm »
Hi tejas! Well , It's simple. Have you followed this example? -
(
http://www.jpct.net/wiki/index.php/Hello_World_for_Android
)
Notice this code in your "onDrawFrame(GL10 gl") section -
if (touchTurn != 0) {
cube.rotateY(touchTurn);
touchTurn = 0;
}
if (touchTurnUp != 0) {
cube.rotateX(touchTurnUp);
touchTurnUp = 0;
}
This rotates the cube in Y and X axis . You can restrict rotation Y (or X ) so it rotates in that axis only by removing that part of code . I hope this helps!
Logged
EgonOlsen
Administrator
quad
Posts: 12297
Re: Animating a object
«
Reply #2 on:
July 03, 2013, 07:15:11 am »
You just have to make sure that your rotation pivot is set in the center of the wheel. The pivot is created based on the object's geometry when calling build(), but can be adjusted afterwards if that is needed.
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
www.jpct.net
»
jPCT-AE - a 3d engine for Android
»
Support
»
Animating a object