Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Metal] SwiftShot porting issues #4970

Open
mykyta-bondarenko opened this issue Oct 11, 2018 · 8 comments
Open

[Metal] SwiftShot porting issues #4970

mykyta-bondarenko opened this issue Oct 11, 2018 · 8 comments
Labels
iOS Issues affecting Xamarin.iOS question The issue is a question
Milestone

Comments

@mykyta-bondarenko
Copy link

The original sample: https://developer.apple.com/documentation/arkit/swiftshot_creating_a_game_for_augmented_reality
Ported sample: https://github.com/xamarin/private-samples/tree/swift-shot/ios12/SwiftShot

  • Download the ported sample
  • Uncomment at least next lines:
  • Run the sample on a device

There is no changes on UI (flags should be animated). If you close the current game and start another one (without quiting the app) - scene view is stuck.
If you comment next line: flag.ParentNode.ReplaceChildNode(flag, clothNode); it will works as always.
I didn't find the reason of it. Could you help me with this issue?

@VincentDondain
Copy link
Contributor

Hi, you sample have build issues with the latest commit 5b98738a53059eafd8ca898bb53cb1ca3bd97d98:

/Users/vince/Documents/private-samples/ios12/SwiftShot/SwiftShot/obj/iPhone/Debug/device-builds/iphone10.6-12.1/actool/cloned-assets/Assets.xcassets : actool warning : The image set "closePressed" has an unassigned child.
/Users/vince/Documents/private-samples/ios12/SwiftShot/SwiftShot/obj/iPhone/Debug/device-builds/iphone10.6-12.1/actool/cloned-assets/Assets.xcassets : actool warning : The image set "closePressed" has an unassigned child.
Core/Interactions/Projectile.cs(99,25,99,31): warning CS0108: 'Projectile.Create<T>(SCNNode)' hides inherited member 'GameObject.Create<T>(SCNNode)'. Use the new keyword if hiding was intended.
Core/Gameplay State/GameManager.cs(1474,25,1474,39): error CS1061: 'GameManager' does not contain a definition for 'flagSimulation' and no extension method 'flagSimulation' accepting a first argument of type 'GameManager' could be found (are you missing a using directive or an assembly reference?)
Core/Gameplay State/GameManager.cs(1476,26,1476,40): error CS1061: 'GameManager' does not contain a definition for 'flagSimulation' and no extension method 'flagSimulation' accepting a first argument of type 'GameManager' could be found (are you missing a using directive or an assembly reference?)
Core/Gameplay State/GameManager.cs(1477,26,1477,40): error CS1061: 'GameManager' does not contain a definition for 'flagSimulation' and no extension method 'flagSimulation' accepting a first argument of type 'GameManager' could be found (are you missing a using directive or an assembly reference?)
    3 Warning(s)
    3 Error(s)

Full build log: https://gist.github.com/VincentDondain/d7e10730814320609044b4fe33790550

@VincentDondain VincentDondain added the need-info Waiting for more information before the bug can be investigated label Oct 11, 2018
@VincentDondain VincentDondain added this to the Future milestone Oct 11, 2018
@VincentDondain
Copy link
Contributor

Ok didn't realize there was code to uncomment. Got it building, it makes my device restart... So yea I can confirm there's an issue. Investigating.

@VincentDondain VincentDondain added iOS Issues affecting Xamarin.iOS question The issue is a question and removed need-info Waiting for more information before the bug can be investigated labels Oct 12, 2018
@VincentDondain
Copy link
Contributor

I see some C3DMeshElementSetPrimitives invalid index buffer size and Execution of the command buffer was aborted due to an error during execution. <private>. Those seem to be the cause of the crashes.

Probably from https://github.com/xamarin/private-samples/blob/swift-shot/ios12/SwiftShot/SwiftShot/Core/Gameplay%20State/Flag.cs#L300-L339

@VincentDondain
Copy link
Contributor

Mmh all the values in CreateFlagSimulationFromNode seem correct to me (was looking for matrices issues compared to the native code).

@VincentDondain
Copy link
Contributor

Ok so I think it has to do with meshData.Geometry: https://github.com/xamarin/private-samples/blob/swift-shot/ios12/SwiftShot/SwiftShot/Core/Gameplay%20State/Flag.cs#L303 and probably https://github.com/xamarin/private-samples/blob/swift-shot/ios12/SwiftShot/SwiftShot/Core/Gameplay%20State/Flag.cs#L76-L168 (still pretty vague).

Doing var clothNode = SCNNode.FromGeometry (SCNPlane.Create (Width, Height)); (while not giving us the desired outcome) helps us avoid the errors I noted in
#4970 (comment).

@VincentDondain
Copy link
Contributor

VincentDondain commented Oct 12, 2018

Ok progress, the buffers have some incorrect length due to the fact you're using SCNVector3.SizeInBytes (12 bytes) instead of Marshal.SizeOf (typeof (NVector3)) (16 bytes).

So 1 fix is to replace all SCNVector3 by NVector3 in https://github.com/xamarin/private-samples/blob/swift-shot/ios12/SwiftShot/SwiftShot/Core/Gameplay%20State/Flag.cs#L76-L168 but unfortunately that's not enough to fix the entire problem.

Need to investigate more.

@mykyta-bondarenko
Copy link
Author

@VincentDondain shouldn't we convert it to the bug?

@VincentDondain
Copy link
Contributor

Hi, no sorry we still need to investigate more to pinpoint specific issues (bug), I haven't had time to get back to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iOS Issues affecting Xamarin.iOS question The issue is a question
Projects
None yet
Development

No branches or pull requests

2 participants