saharan / OimoPhysics

A cross-platform 3D physics engine
MIT License
863 stars 68 forks source link

add getSleeping #7

Closed lo-th closed 6 years ago

lo-th commented 6 years ago

can be cool to add

public inline function getSleeping():Bool{ return _sleeping; }

to rigidBody because _sleeping is rename on compile

lo-th commented 6 years ago

yes something wrong with minifying version many importante fonction are rename like setGravity for world

saharan commented 6 years ago

okay I'll add a function to get a rigid body's sleeping state (maybe isSleeping?) in the next release.

many importante fonction are rename

I couldn't find functions renamed, is it fixed in the latest version 1.1.2?

lo-th commented 6 years ago

mm isSleeping is more like a variable name, getSleeping is better i think

for rename fonction is only for minified version OimoPhysics.min.js i'm on 648 ko for min with good function name. i don't use haxe is come from compression methode, i gess

also i rename window to self for using oimo on worker i have version soon in worker anyway performance is very good.

saharan commented 6 years ago

hmm, It's best if I could use getter and setter functions but Haxe seems not to support these functions for now... I'll consider the name of the function again.

most functions including World.setGravity are renamed in minified js, but are exported to prototypes with their original names. so you can still use them by their original names, can't you?

I might change wrapping anonymous function so that it accepts "global" object to export...

lo-th commented 6 years ago

yes is right work on last version no need getter and setter is only for return _sleeping value

saharan commented 6 years ago

RigidBody.isSleeping has been added in v1.2.0 https://github.com/saharan/OimoPhysics/commit/a4f307b05eb87d3b1d8a86293cdf75ede7f7b92b I chose isSleeping for the function name, because in many languages it's recommended to use prefix is instead of get for functions which return a boolean value.

lo-th commented 6 years ago

ok great thanks