godot_recipes icon indicating copy to clipboard operation
godot_recipes copied to clipboard

[Discussion] Basics: Circular Movement

Open cbscribe opened this issue 4 years ago • 5 comments

Discussion for http://godotrecipes.com/basics/rotation/

cbscribe avatar Feb 03 '21 02:02 cbscribe

For the 2D version, how would you make the godot icon stay vertical while rotating? And how would you add a CollisionShape2D to it? (mine stays centered and doesn't inherit the offset)

samlaf avatar Mar 08 '21 03:03 samlaf

If you didn't want the sprite to rotate, you could negate the rotation it's getting from its parent:

func _process(delta):
    $Sprite/Pivot.rotation += rotation_speed * delta
    $Sprite/Pivot/Sprite2.global_rotation = 0
    

I'm not sure what you mean by "adding a CollisionShape to it". What are you adding a collision shape to - there are no collision objects in this demo...

cbscribe avatar Mar 10 '21 07:03 cbscribe

Thank you :) This does work. As for the CollisionShape2D, I just wanted to add it to the sprite so that a vehicle could collide with the sprite and gain some powerup or whatnot. I got it working like so. image I personally think you should remove the first sprite and get the minimal working example. I was confused for a while as to what exactly the pivot was doing (eg. should it also be offset?)

samlaf avatar Mar 14 '21 17:03 samlaf

I'm working on a space game and trying to make an elliptical orbit.

Would I be able to use this method somehow with two pivot points, one nested on another (something like the pic below) or would I have to take a different approach to this? Screenshot 2021-05-30 132755

If I can use this, what might the code look like for it?

Serenade5678 avatar May 30 '21 17:05 Serenade5678

Hello, I am new to GitHub, but I need help in creating an 2D air ring with x-z axial revolution by using Particles2D. Can someone help me?

BlueLightningWizard avatar Feb 07 '22 07:02 BlueLightningWizard