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

CollisionShape2D scale() not working? #7375

Closed
Qws opened this issue Dec 27, 2016 · 3 comments
Closed

CollisionShape2D scale() not working? #7375

Qws opened this issue Dec 27, 2016 · 3 comments
Labels

Comments

@Qws
Copy link

Qws commented Dec 27, 2016

This is my node hierarchy:
image

Hierarchy:
RigidBody2D
  Sprite
  CollisionShape2D

I'm trying to scale down the Rigidbody2D node (Flame node):

image

This is how I'm doing it. Sprite nodes scales down when I scale its parent down, but the Collision node does not.

Which is strange, because , if I do this in the graphical editor, everything scales perfectly fine, including the CollisionShape2D.

So I realise that I can't change CollisionShape2D size with the scale() method.

But how else can I scale a node with a CollisionShape2D?, I tried to to code within the CollisionShape2D node, it doesn't work either. So what can I do to dynamically shrink the Node with a collision?

Someone on IIRC told me to swap with 2 collision, but is that really the only way?

Link to minimal example project (optional but very welcome):

Fire.zip

@eon-s
Copy link
Contributor

eon-s commented Dec 27, 2016

I think is duplicated of #5734

Apart from that, CollisionShape is a helper, wont scale the body's shapes or do anything other than add editor and debug tools.

You will have to scale the shape resources manually (get/set shape) and children (shapes are not children) instead of the body until Godot 3.x changes something on the way shapes are managed.

@Qws
Copy link
Author

Qws commented Dec 31, 2016

I basically replaced RigidBody2D with KinematicBody2D. Now it works.

I actually don't see the purpose of RigidBody2D... it's not programmeable in runtime, while the KinematicBody2D is.

@akien-mga
Copy link
Member

Duplicate of #5734 indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants