Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - behelit

Pages: [1]
1
Yes, that was the problem.
Thanks for the help everyone.


2
Thanks, you were right, now it rotates the correct amount but it is still only rotating on it's own axis and not the pivot


3
Let me explain a little better.
I'm trying to rotate objects around a central point (0,0,0), in the same manner as clock hours, like this:


They don't need to move dynamically so it is all done before onDrawFrame.
The primitive in the image is a Cone.

When trying to rotate with setRotationPivot, I do the following in a loop:
Code: [Select]
clockBar[i].translate(new SimpleVector(0, 5, 0));
clockBar[i].setRotationPivot(new SimpleVector(0, -5, 0));
clockBar[i].rotateZ(((float) i / 10) * 361f); // To create the sequential positions around the clock

world.addObject(clockBar[i]);

but this produces the following, which appears to rotate around itself instead of 0,0,0:



am I misunderstanding how the pivot works?

Eventually it will be something like this, which I wrote in normal openGL and I'm converting to jpct:


4
Support / Rotating multiple objects around a single object or center
« on: March 14, 2018, 04:47:23 am »
I'm struggling with a rotation concept.
I'm trying to rotate objects sequentially around a single point. Similar to each of the hours on a clock.
For example, I have 10 primitives and I want to loop these around a central point.
In opengl I could do something like:

Code: [Select]
for (int i = 0; i < 10; i++)
{
gl.glPushMatrix();

gl.glRotatef(((float) i / 10) * 361f, 0f, 0f, 1f);
gl.glTranslatef(0, 5f, 0);

clockBar.draw(gl, 0);
gl.glPopMatrix();
}

But I can't seem to achieve this through jpctae. From what I understand, all of the rotations/translations are performed at the end. So it isn't possible this way.

I've also tried attaching to a dummy object then rotating that but it's the same result because of the same fact.

Would using matrices solve this? Combinig the translation and rotations?

5
Projects / Re: RotR
« on: January 10, 2015, 04:19:33 am »
Thanks Egon!   ;D

6
I would highly recommend using Sensor.TYPE_ROTATION_VECTOR instead of the others. It automatically combines the sensors and applies low pass filtering, producing a smoother result similar to the Google camera's photosphere, although it may depend on sdk version used (API 9+).
It also combines gyro data and handles devices without gyroscopes by falling back to accelerometer only.

You can also do portrait mode by applying the appropriate remapping, I don't remember the exact mapping but can test it if people actually need it.





7
Projects / RotR
« on: December 17, 2014, 10:00:19 am »
Hey All,

I've just released my JPCT-AE game to the play store and would love some feedback:

https://play.google.com/store/apps/details?id=softigloo.rotrgame

It's an augmented style game where you rotate to the target and push your device to shoot




8
Support / Start game timer once world is ready
« on: October 20, 2014, 03:03:39 am »
I'm hoping this is a common thing, I'm trying to start a game timer once everything has been loaded.

I've tried several places like the renderer creation, onsurfacechanged, ondraw (first frame) and after all the obj objects have been loaded but there's still a time difference on lower end devices, ie: 1 - 3 seconds on the timer once you actually are able to start playing the game.

Is there a JPCT function that I can use instead? I noticed even though I start the timer once I have loaded everything, JPCT actually does a lot of compilation afterwards eg:

Code: [Select]
Resetting game timers
Subobject of object 5/object7 compiled to flat fixed point data using 324/324 vertices in 23ms!
Object 5/object7 compiled to 0 subobjects in 71ms!
Object 'object7' uses one texture set!
Subobject of object 1/object3 compiled to indexed fixed point data using 6912/1352 vertices in 4082ms!
Object 1/object3 compiled to 0 subobjects in 4925ms!
Object 'object3' uses one texture set!
Subobject of object 7/object9 compiled to flat fixed point data using 30/30 vertices in 7ms!
Object 7/object9 compiled to 0 subobjects in 11ms!
Object 'object9' uses one texture set!
Subobject of object 9/object11 compiled to flat fixed point data using 72/72 vertices in 6ms!
Object 9/object11 compiled to 0 subobjects in 20ms!
Object 'object11' uses one texture set!
Subobject of object 11/object13 compiled to flat fixed point data using 72/72 vertices in 7ms!
Object 11/object13 compiled to 0 subobjects in 17ms!
Object 'object13' uses one texture set!
Subobject of object 13/object15 compiled to flat fixed point data using 171/171 vertices in 16ms!
Object 13/object15 compiled to 0 subobjects in 39ms!
Object 'object15' uses one texture set!
Subobject of object 15/object17 compiled to flat fixed point data using 72/72 vertices in 7ms!
Object 15/object17 compiled to 0 subobjects in 18ms!
Object 'object17' uses one texture set!
 GC_CONCURRENT freed 1624K, 34% free 8186K/12359K, external 19863K/20799K, paused 3ms+3ms
Subobject of object 3/object5 compiled to indexed fixed point data using 7290/1313 vertices in 4273ms!
Object 3/object5 compiled to 0 subobjects in 5145ms!
Object 'object5' uses one texture set!
Subobject of object 17/object19 compiled to flat fixed point data using 96/96 vertices in 9ms!
Object 17/object19 compiled to 0 subobjects in 25ms!
Object 'object19' uses one texture set!
Subobject of object 19/object21 compiled to flat fixed point data using 288/288 vertices in 21ms!
Object 19/object21 compiled to 0 subobjects in 57ms!
Object 'object21' uses one texture set!
Creating buffers...
VBO created for object 'object5'
Creating buffers...
VBO created for object 'object19'
Creating buffers...
VBO created for object 'object21'
Creating buffers...
VBO created for object 'object13'
Creating buffers...
VBO created for object 'object11'

Any advice appreciated~!

 

Pages: [1]