-
Notifications
You must be signed in to change notification settings - Fork 114
Long click on a plane => -[SCNNode changeMaterial]: unrecognized selector sent to instance #11
Comments
Here's my workaround.
|
I don't understand your workaround. May you elaborate ? Thanks ! |
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. |
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. |
That's more of a hit detection problem. If it is calling the category method, than it wasn't a plane or a cube that the hit detection thinks you tapped on.
I just wanted to stop the crash. That's what it does. If you look in your console, you can see what class is receiving the tap.
… On Sep 19, 2017, at 12:35 PM, Tasmagic ***@***.***> wrote:
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.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#11 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAKKqCShLrvNY6FgRzWln2-2QaStOVRZks5skBdmgaJpZM4PWLkp>.
|
If it's not a Cube, check if it's a Plane then call changeMaterial ....... I think the hit detection problem is that before hitting a Plane it can hit a feature point |
Hi,
I want to change the material of a plane. When I perform a long click on a plane, I got the following error:
** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SCNNode changeMaterial]: unrecognized selector sent to instance
On:
[((Plane *)parentNode) changeMaterial];
Any idea?
Thanks.
The text was updated successfully, but these errors were encountered: