You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! Filing this bug report from my phone, so can't make a minimal reproduction now, but can if one would be helpful.
Many of the physics APIs (e.g., RigidBodyComponent.applyImpulseRotation) take either a Vec3 or the component numbers of a Vec3. However, they do not throw if they're provided an Array instead of a Vec3.
These methods (when erroneously called with an Array) often cause the object to disappear / end up somewhere very out of frame. I haven't spent much time investigating what happens once I realized what the issue was.
It seems to me that it would be better mannered for the RigidBodyComponent methods to throw on bad input.
Steps to Reproduce
Make an Entity with a RigidBodyComponent and Script.
In the script, call RigidBodyComponent.applyImpulseRotation, and provide an array with 3 components (e.g., [1, 1, 1]).
Observe that the Entity is no longer in the expected location.
The text was updated successfully, but these errors were encountered:
There is an API documentation for such cases. It specifies what attributes are accepted by various methods of the engine. Please, refer to it whenever in doubt.
Hey! I'm aware the documentation exists (and I refer to it frequently), but it should still validate input. Many of the non-physics APIs throw errors in similar cases.
Over the last few years, the types the engine exports for the APIs has improved a lot. Also the new script editor we use in the Editor is based on Monaco (same code base used by VS Code), and this highlights issues if an incorrect type of the parameter is used. We also have plugin for VS Code that can be used to edit the scripts, highlighting these issues.
At the moment, we're not planning to add runtime checking.
There is also a community contributed tool that can help with this: #5817
Description
Hi! Filing this bug report from my phone, so can't make a minimal reproduction now, but can if one would be helpful.
Many of the physics APIs (e.g., RigidBodyComponent.applyImpulseRotation) take either a Vec3 or the component numbers of a Vec3. However, they do not throw if they're provided an Array instead of a Vec3.
These methods (when erroneously called with an Array) often cause the object to disappear / end up somewhere very out of frame. I haven't spent much time investigating what happens once I realized what the issue was.
It seems to me that it would be better mannered for the RigidBodyComponent methods to throw on bad input.
Steps to Reproduce
The text was updated successfully, but these errors were encountered: