This is my first time porting my game over to iOS. The game works and pretty much all the functions wordk. However I’ve noticed a weird problem where my characters “eyes” position are not being clamped. This is not a problem when testing on web or web-mobile.
Here is the code and I highlighted the code that is not getting called it seems. But iOS simulator X code is not throwing up any error messages in regards to this code. It just seems like the code isn’t getting called at all, like it’s commented out or something.
// Set the world position of the eyes
this.eyes.setWorldPosition(desiredNewWorldPosition.x, desiredNewWorldPosition.y, desiredNewWorldPosition.z);
//Limit the eyes position
this.eyes.position.clampf(new Vec3(-2.0, -2.0, -2.0), new Vec3(2.0, 2.0, 2.0)); //<-- THIS CODE NOT RUN IN IOS SIMULATOR ON XCODE.
I confirmed its the this.eyes.position.clampf(new Vec3(-2.0, -2.0, -2.0), new Vec3(2.0, 2.0, 2.0));
by commenting it out on my local running in a browser and its not an issue, i’m using CocosCreator (3.8.3)
The simulator is running iOS version 17.5, iPhone 15 being simulated.
Xcode is version 15.4.
Can’t see any big errors, tried searching for Clampf and Math but no errors/warnings about it.
I also noticed that there is the same issue in the built in simulator.
Edit:
I wrote my own clamp code and the issue is no longer there. I’m almost 100% sure this is an issue inside the cocoscreators position.clampf function when it gets turned to Native code. Strangely no errors, not sure if it’s getting skipped outright.