#Collision not not?

1 messages · Page 1 of 1 (latest)

shrewd kiln
#

Hi! Very new to godot. Trying to remake flappy bird. I made 2 scenes, for player and for pipe (trees attached. I used Node2D because when I tried to scale "RigidBody2D" I got "..will be overriden by physics engine", and scalling manually both collision and sprite sounds wrong.), Then I put them in another scene (img.3). Attached script to RigidBody2D in Player (img.4). Attached signal (img.5). When running the scene bird falls, and i'm able to jump with "space", but OnBodyEntered seems to not trigger. Also for some reason bird seems to rotate only once, like if i would use = instead of +/-=.

stark moat
#

did you scale the node2d?

#

That counts as scaling the rigidbody2d as well

#

since the children inherit the parent's scale

#

i know you don't want to scale the sprite and the collision separately but it's kinda what you have to do

shrewd kiln
stark moat
#

the sprite should be scaled and the collision shape should not, you should instead change the size properties of it

shrewd kiln
#

i think i scaled rigidbody2d

stark moat
#

when you click on the node2d, what is the scale property?

shrewd kiln
#

1x1

#

i'll try to set collision to match sprite, and scale sprite via scale.

stark moat
#

okay

#

anyway, the pipe is an area right?

#

so the onbodyentered function will not detect it

#

it's an area, not a body

shrewd kiln
#

oh.

stark moat
#

usually detections like this work in the reverse, the area is the one detecting the body

#

so the player would be an area instead of the pipe

shrewd kiln
#

is there any way for player to detect area instead?

stark moat
#

also, you are rotating the bird 30 degrees every frame

stark moat
shrewd kiln
stark moat
#

rigidbody2d does not have any signals for detecting areas

stark moat
shrewd kiln
#

i'll try setting it lower

#

definitly no

#

it acts like if i would use =

#

maybe something overrides that after render

#

like physics engine?

stark moat
#

actually you're right

#

the rigidbody probably is overriding it

#

if you want to control the rotation you probably should use a different node

#

or rotate the sprite only and not the rigidbody

shrewd kiln
#

yeah, works fine now

#

thank you!