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

move() turns KinematicBody2D's scale from negative to positive #5929

Closed
p4ngy4 opened this issue Jul 27, 2016 · 18 comments
Closed

move() turns KinematicBody2D's scale from negative to positive #5929

p4ngy4 opened this issue Jul 27, 2016 · 18 comments

Comments

@p4ngy4
Copy link

p4ngy4 commented Jul 27, 2016

on v2.1_beta_20160721_win64

If you use the move() function on a KinematicBody2D, and it's scale is set to negative, it's scale will become positive after moving.

extends KinematicBody2D

func _ready():
    set_scale(Vector2(-2,-2))
    print("before move: ",get_scale())
    move(Vector2(3,3))
    print("after move: ",get_scale())

This code should print:
before move: -2,-2
after move: 2,2

@akien-mga akien-mga added this to the 2.1 milestone Jul 27, 2016
@akien-mga
Copy link
Member

Confirmed in the current master branch. It also seems to behave weirdly as the children that were inheriting the negative scale of their parents are still displayed as scaled negatively (e.g. a Sprite would be h- and v-flipped), but setting the scale anew seems to trigger weird mood swings...

@reduz
Copy link
Member

reduz commented Jul 27, 2016

I don't think physics likes negative scaled shapes, so this is probably not a bug. I suggest you scale/flip the artwork instead

@p4ngy4
Copy link
Author

p4ngy4 commented Jul 28, 2016

well I also want to flip a couple different shapes attached to the kinematicbody. Maybe change this to a feature request to allow negative scaled shapes in physics.

@Keyaku
Copy link
Contributor

Keyaku commented Jul 30, 2016

Mine works fine; all I do is constantly scale very time it detects a change in direction (left-to-right and vice-versa).

@akien-mga akien-mga modified the milestones: 2.2, 2.1 Jul 31, 2016
@Sslaxx
Copy link

Sslaxx commented Jul 31, 2016

@Keyaku - does this affect performance at all?

@Keyaku
Copy link
Contributor

Keyaku commented Jul 31, 2016

@Sslaxx My project is in early stages, so the environment this piece of code is in hasn't that many things happening at once yet; that being said, I can see no performance loss (and I'm working on a medium performant Mac machine).

@bruno-ortiz
Copy link
Contributor

Any news on this?

@reduz
Copy link
Member

reduz commented Mar 21, 2017 via email

@bruno-ortiz
Copy link
Contributor

At least can i set the rotation of a shape? I have a polygonShape2d that i want to rotate with the sprite.

@reduz
Copy link
Member

reduz commented Mar 21, 2017 via email

@Keyaku
Copy link
Contributor

Keyaku commented Mar 21, 2017

Forgot to give an update on this: Just like @reduz said, use sprite flipping.

@akien-mga akien-mga modified the milestones: 3.0, 2.2 Aug 8, 2017
@akien-mga akien-mga removed the bug label Aug 8, 2017
@akien-mga
Copy link
Member

As mentioned above, this is not a bug but a limitation of physics bodies, so closing.

@fabriceci
Copy link
Contributor

fabriceci commented Oct 21, 2019

I faced the same issue today, It would be nice if in some way this property is disabled for those kind of node (or at least a warning message is displayed if we tried to use it)

@Sslaxx
Copy link

Sslaxx commented Oct 21, 2019

@fabriceci - With 2.1.x or 3.1.x or a latest Git build of 3.2? If it's one of the 3.x series might be worth opening a new bug and referring to this one.

@fabriceci
Copy link
Contributor

@Sslaxx It's on the 3.2 alpha 2. I will open a new issue.

@Muller-Castro
Copy link
Contributor

I had the same issue here... I've just set scale.x = -1.0 and called move_and_slide and it ended up flipping the Y axis and the rotation went from 0 to -180

image

@chucklepie

This comment has been minimized.

@Calinou
Copy link
Member

Calinou commented Sep 20, 2020

@chucklepie We know physics issues are frustrating, but please don't bump issues out of frustration.

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

No branches or pull requests

10 participants