Login Action Required

The NinevehGL Forum uses a new concept of "socialized forum" or as we like to say "Tweet Forum".

Here is the deal:
  1. No new registration is required. Just sign in with your Twitter account and authorize the NinevehGL Forum.
  2. Once you’re in, you'll be able to "Follow a Thread", that means every time that thread receive a new post or update you'll receive a mention on your twitter.
  3. Besides, you can enable "Auto Share", then every new post and/or thread you make will be tweeted on your timeline. (By default, auto-share is enabled only for your threads)

Forum Rules:

1. We understand human comunication can become "hot" sometimes. So some insults and bad words ARE allowed. Just don't push too much being an asshole all the time.

2. SPAMMERS are not allowed. There are penalties for this kind of user and they can be banned forever.

3. You can report other users, if you judge necessary. An user reported many times by many people can also be banned forever. However you can also receive penalties for report deliberately for no apparent reason.

If there is a similar thread title, make sure the other one doesn't already have the answer you're looking for.

This forum uses the BBCode (Bulletin Board Code), here are some instructions:

Bold: [b]text[/b]
Italic: [i]text[/i]
Underline: [u]text[/u]

Code: [code]text[/code]

[ul] [*]item [/ul]
[ol] [*]item [/ol]



Embed (videos, code, 3D):

Welcome to the NinevehGL's world!
NinevehGL is a 3D engine forged with pure Obj-C.
Welcome to the
Hello, Guest.

Your current vote:

You can change your vote many times. But it's still one single vote.

Touching Collada Meshes
Vote this thread:


Posts: 14


Wed, Jul 11 2012

Hi everyone,

I currently occupied with creating an application that involves usage of collada files. For this purpose NinvehGl is very easy to use, but I want to include some touch behaviour.

I could not find any documentation regarding this in the ninevehGL - doc on the website, but I found some information in the header file of NGLCamera.

The method touchingUnderPoint seems suitable and I'm trying to use it in order to move a mesh.

Similar to the thread "touching and order in NGLGroup3D" I'm using it in this way:

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *) event {

NSLog(@"Touches Began called");
CGPoint touchedPoint = [[touches anyObject] locationInView: self.view];

NSLog(@"touched point x=%f, y=%f", touchedPoint.x, touchedPoint.y);

if ( touchedPoint.x > 746 && touchedPoint.y > 1000) {
[self dismissModalViewControllerAnimated: YES];

NGLTouching touchingStruct = [_camera touchingUnderPoint: touchedPoint];
NSLog(@"touchingUnderPoint name %@\n", touchingStruct.mesh.fileNamed);

[self moveMesh: touchingStruct.mesh];

- (void) moveMesh: (NGLMesh*) mesh {
static float xMovementOfMesh = 0;
NSLog(mesh.isTouchable ? @"mesh.isTouchable = YES" : @"mesh.isTouchable = NO");

xMovementOfMesh = 0.1;

[mesh moveRelativeTo: NGLMoveLeft distance: xMovementOfMesh];


I have the following problems:
For simplicity reasons I'm using the cube provided by the ninevehGL standard projects as the 3D mesh object.

My viewDidLoadMethod looks like this:
- (void) viewDidLoad {

[super viewDidLoad];

// Setting the loading process parameters.
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
kNGLMeshCentralizeYes, kNGLMeshKeyCentralize,
@"0.3", kNGLMeshKeyNormalize,

_mesh = [[NGLMesh alloc] initWithFile:@"cube.obj" settings:settings delegate:nil];
_mesh.rotationSpace = NGLRotationSpaceLocal;

_mesh.touchable = YES;//can also be NO - it does not change anything

_camera = [[NGLCamera alloc] initWithMeshes:_mesh, nil];
_camera.lookAtTarget = _mesh;

[_camera autoAdjustAspectRatio:YES animated:YES];

// Starts the debug monitor.
[[NGLDebug debugMonitor] startWithView: (NGLView *)self.view];

First of all, the camera looks at the front surface of the cube, but when I touch the cube, the touch is not recognized on its whole front surface - I have to touch more on the top right corner of the cube in order to move the cube.

The second issue I have is, that the cube does not move to the left as I intended with the method moveMesh, as seen above. The cube rotates a little bit around its own Y - axis and moves to the -z axis also, when the touch is recognized properly.

For sure I am not aware of all functionality provided by the ninevehGL engine and especially regarding its touch recognition. So if I used some method in a wrong manner or if there is information I am missing, please tell me.

I also want to say that the ninevehGL engine has helped me big time working with OpenGL, so many things to all programmers involved.

0% like this - 0/0


Posts: 14


Wed, Jul 11 2012

In response to: @MJ_uni

Hey, I have found the problem.

_camera.lookAtTarget = _mesh;

did mess it up. Now the translation of the object after a touch is fine.

Nevertheless, the position where a touch on an object is recognized is still off. I still need to tap on the object a on its right corner and also beyond the object itself to get a touch recognition of the object itself.

When I am touching the object on its lower left part, the touch is not recognized at all.
0% like this - 0/0


Posts: 14


Wed, Jul 11 2012

In response to: @MJ_uni

Hi, me again.

I think I made an interesting observation.

It seems that the recognition whether a 3D object has been touched or not is a little bit off.
As I said in the previous post, when I'm touching an object on its lower left part, the touch is not recognized as "hitting the object", thus I have to click more to to the right in order to getting the touch recognized on the object.

This still seems to be the case, however, for fun sake I rotated the simulator 90° till 360° and afterwards the recognition was way more accurate.
The "mechanism" used in order to check whether an object has been touched or not has something to do with a "bounding box" drawn around an object right?

So it seems that the bounding box is a little bit off and after the rotation it seems to be more accurate.

Can someone confirm this or deny this?

0% like this - 0/0


Posts: 571


Wed, Jul 11 2012

In response to: @MJ_uni

Hello buddy,

In fact, all the answer is simple...

There is no Touch API in NinevehGL yet.
What you see in the header file is just a test, that doesn't work at all.

The real and full touch API is coming soon, in the next version.
This may take few months.

100% like this - 2/2


Posts: 14


Thu, Jul 12 2012

In response to: @dineybomfim

Thanks for your reply.

Even though the touch api isnt there yet, the "test" method touchingUnderPoint: seems promissing to me, as far as I can judge.

Right on.
100% like this - 1/1


Posts: 7


Wed, Jul 18 2012

In response to: @dineybomfim

Waiting for Touch API...
it will very usefull for us...

100% like this - 1/1


Posts: 4


Sun, Sep 21 2014

In response to: @dineybomfim

I'm wondering if the Touch API for NivenehGL is supported yet?

0% like this - 0/0


Posts: 4


Tue, Dec 9 2014

In response to: @phamdacloc

Looks forward to it, too.
0% like this - 0/0

NinevehGL is a 3D engine built right on top of OpenGL ES and it uses all the programmable pipeline power, making it easy for you to create great application with shaders.

Share on

Follow NinevehGL
Fastest way to contact us:

Copyright © 2011 db-in. All rights reserved.