fix(part): size validation
This commit is contained in:
parent
187308be90
commit
f16f3a8b79
1 changed files with 6 additions and 0 deletions
|
@ -57,6 +57,12 @@ void BasePart::OnWorkspaceRemoved(std::shared_ptr<Workspace> oldWorkspace) {
|
||||||
void BasePart::onUpdated(std::string property) {
|
void BasePart::onUpdated(std::string property) {
|
||||||
bool reset = property == "Position" || property == "Rotation" || property == "CFrame" || property == "Size" || property == "Shape";
|
bool reset = property == "Position" || property == "Rotation" || property == "CFrame" || property == "Size" || property == "Shape";
|
||||||
|
|
||||||
|
// Sanitize size
|
||||||
|
// TODO: Replace this with a validator instead
|
||||||
|
if (property == "Size") {
|
||||||
|
size = glm::max((glm::vec3)size, glm::vec3(0.1f, 0.1f, 0.1f));
|
||||||
|
}
|
||||||
|
|
||||||
if (workspace() != nullptr)
|
if (workspace() != nullptr)
|
||||||
workspace()->SyncPartPhysics(std::dynamic_pointer_cast<BasePart>(this->shared_from_this()));
|
workspace()->SyncPartPhysics(std::dynamic_pointer_cast<BasePart>(this->shared_from_this()));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue