Code Monkey home page Code Monkey logo

Comments (6)

tblanchard avatar tblanchard commented on June 1, 2024

Here's my workaround.

@interface SCNNode (Damn)
- (void)changeMaterial;
@end

@implementation SCNNode (Damn)
- (void)changeMaterial
{
    NSLog(@"changeMaterial sent to instance of %@",[self class]);
}
@end

from arkit-by-example.

Tasmagic avatar Tasmagic commented on June 1, 2024

I don't understand your workaround. May you elaborate ? Thanks !

from arkit-by-example.

tblanchard avatar tblanchard commented on June 1, 2024

Some instance of SCNNode is being sent the message changeMaterial that does not implement changeMaterial. Only the subclass Cube implements changeMaterial but the code sending the message isn't checking that the node it is sending changeMaterial is a Cube (or better - respondsToSelector:@selector(changeMaterial)).

So I added a category to SCNNode called changeMaterial that simply logs the message. It is overridden by the method in Cube. So now it is no longer an "error" to send changeMaterial to any SCNNode.

from arkit-by-example.

Tasmagic avatar Tasmagic commented on June 1, 2024

The problem is that with your solution the user has to click several times on the plane in order to be able to change its material. He has to click until the correct instance (Plane) is returned. This is not satisfying. I don't understand why the plane is not detected reliably when I click on it.

from arkit-by-example.

tblanchard avatar tblanchard commented on June 1, 2024

from arkit-by-example.

FA65 avatar FA65 commented on June 1, 2024

If it's not a Cube, check if it's a Plane then call changeMaterial

.......
if ([parentNode isKindOfClass:[Cube class]]) {
[((Cube *)parentNode) changeMaterial];
} else if ([parentNode isKindOfClass:[Plane class]]) {
[((Plane *)parentNode) changeMaterial];
}

I think the hit detection problem is that before hitting a Plane it can hit a feature point

from arkit-by-example.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.