Skip to content

Crash on (parentNode as! Plane).changeMaterial() #1

@Tasmagic

Description

@Tasmagic

Hi,

When I try to change the material of a plane by a long click on it, I get the following error:

Could not cast value of type 'SCNNode' (0x1b4e36850) to 'arkit_by_example.Plane'

It happens on the following code:

(parentNode as! Plane).changeMaterial()

It is due to the fact that the parentNode is not of type Plane but of type SCNNode.

It is not a proper solution to check if the parentNode is of type Plane because it means that in many cases a long click on a plane will not fire a change of its material (bad user experience). The problem is that it seems that the hitTest is not reliable.

Any solution ?

Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions