#Help with 2d Physics

1 messages · Page 1 of 1 (latest)

winged rose
#

I'm trying to make a 2d volleyball game and i'm trying to work on making the ball bounce off my "arms" as if its the floor but it just seems to crawl up my arm and glitch my character out.

runic wyvern
#

What code do you have for the bouncing part?

winged rose
#

i'm currently just using built in stuff for the bouncing on the floor and i don't have anything for the "arms" because i don't know physics in the slightest

runic wyvern
#

What type of node are the arms?

winged rose
#

the arms are rigid bodies

#

that was my attempt to making it so i wouldn't have infinite collisions when the ball touches my arms

runic wyvern
#

Why wouldn't you want it to have "infinite collision"?
Shouldn't it always bounce off?

#

btw, what is the code for moving the arm?

winged rose
#

yes but i thought the problem was that the ball was colliding with my arms and just flying up them because of it

#

just one line for the arms

#

i'm brand new to this and i'm aware this is very ambitious

runic wyvern
#

look_at() doesn't use physics. You must use one of the methods from RigidBody2D

#

like apply_impulse() or angular_velocity()

winged rose
#

that sounds hard to do

#

but makes a lot of sense

runic wyvern
#

Phyisics are kinda complicated.

If anything, a StaticBody for the arm may work as well.

winged rose
#

i tried making it so that the look at would work

#

thats my node setup

#

the node 2d is so that it has a pivot point

runic wyvern
#

I am not sure if a bare Node2D works as a pivot.
Maybe with a Hinge of sorts.

winged rose
#

it somehow works for me

#

maybe not properly

runic wyvern
#

but you're not using physics, so it is possible the arms are just asleep.

#

So they're not falling or anything.

winged rose
#

i have them frozen

#

so thats why i assume

runic wyvern
#

aaah, that would do it.

winged rose
#

so how would i keep it attached to my body

#

without freezing it

runic wyvern
#

Joint3D nodes should help.
But as a first project, i'd recommend doing some basic vector math for bouncing the ball instead of trying to play with advanced physics like these.

You could make all of this work with just CharacterBody if you wanted.

winged rose
#

3d nodes in a 2d game?

#

is that a thing in this

runic wyvern
#

Ah, sorry, forgot you're using 2D.
You'd use Joint2D

winged rose
#

i did that and it was just swinging

#

but thank you for the help