#Orbiting sword with weight

1 messages · Page 1 of 1 (latest)

burnt tinsel
#

I'm trying to make it so a sword orbits my main character and that weight applies to it so its easier to move it towards the floor or if you leave your mouse it will fall and that its also harder to move it in the oppisisite direction once it gets going and then make it so it speeds up over time.

I'm also wanting to make sparks come off of it that light up the surroundings whenever it hits something and I obviously don't want it clipping through stuff like the floor.

grizzled vapor
#

try playing with Godot's physics3d joints -- you want a pin joint joining the body to the sword system, and potentially a pin joint between the sword and the sword system, so that when the sword would hit the floor the blade rotates

#

you want to detect collision between the sword and the ground to emit a signal on collide; I think normal rigidbody on_body_enter events would suffice (the sparks are a particle emitter which triggers on those signals)

#

and you want some kind of constant force mechanism to draw the sword towards its target point -- since the force is constant, when it works with gravity it's greater, and when it works against it's lesser, which will give the perception of weight

burnt tinsel
burnt tinsel
grizzled vapor
#

you want to do something pretty complex, so you'll have to break it down into parts

#

which part do you want to start with? What have you tried, what is giving you trouble?

burnt tinsel
grizzled vapor
#

what I said doesn't matter; what you want to build matters. You want a lot of things. Which thing do you want to build first? (usually: start simple and build from there)

burnt tinsel
#

Whilest pointing away

grizzled vapor
#

hey now

burnt tinsel
#

Pretty simple

grizzled vapor
#

start simpler

#

it doesn't point away yet

#

it just orbits 😄

burnt tinsel
#

Okay

#

👍

grizzled vapor
#

so what do you need? DO you have a player sprite and a sword sprite?

#

Are they in a scene?

burnt tinsel
#

Yes

grizzled vapor
#

How do you want to control the orbit?

burnt tinsel
#

By mouse position

grizzled vapor
#

ok! Need anything from me?

burnt tinsel
grizzled vapor
#

Do you know:
0. Godot mouse APIs (read the docs)

  1. Godot physics in general (read the intro)
  2. Godot character controllers in specific (read the intro) -- note I'm suggesting you write a "character controller" for the sword, since it's kind of a character to you now 🙂
  3. Enough geometry to get into trouble (the docs)
    ?
#

With those put together, you have the information to write a little SwordController that knows where the mouse & the player is, and makes a decision about where the sword should be (using geometry), and then steps towards there

#

(bonus: you can also make it point the correct direction from that same piece of code 😄 )

burnt tinsel
#

Been learning for like a month on godot but around 4 in total bc unity, unreal I tried them but not my thing unreal maxed my vram

grizzled vapor
#

I didn't ask that, really what I did was I gave you a bunch of reading homework 😄

burnt tinsel
#

: (

#

Lol

grizzled vapor
#

there's no way around it, if you want to make something fancy, you gotta learn to make something fancy!

#

(and the docs are pretty well laid out. You can probably finish it all in... dunno, under 20m? Depends how fast you read 🙂 )

burnt tinsel
#

Oh dam thought it was going to be like 2 hours

#

Got worried

grizzled vapor
#

this is pretty similar to "moving a character around" honestly

#

so you can probably skim that part of it, it's just review

burnt tinsel
#

Ye this is just for the orbiting right? I'm guessing that the gravity and stuff is more advanced

grizzled vapor
#

it is, but it's not very much more advanced, we'll cross that bridge when we get to it