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

bullets.gd .... demo code has issues, doesn't make any sense? #1141

Open
RichardEllicott opened this issue Nov 27, 2024 · 2 comments
Open

bullets.gd .... demo code has issues, doesn't make any sense? #1141

RichardEllicott opened this issue Nov 27, 2024 · 2 comments

Comments

@RichardEllicott
Copy link

RichardEllicott commented Nov 27, 2024

demo:
https://github.com/godotengine/godot-demo-projects/blob/master/2d/bullet_shower/bullets.gd

i don't understand the logic of this demo, it is for the PhysicsServer2D but it manually moves the particles and disables collisions

there is no point in this demo having the PhysicsServer2D in it..... actually the demo simply builds a wrapper class and tracks a position in there, it doesn't even change the particles actual positions (so cannot do any collision)

in the server we have this code

PhysicsServer2D.body_set_state(body, PhysicsServer2D.BODY_STATE_LINEAR_VELOCITY, velocity)

i cannot get this working myself yet, but that is what an example should have in it

EDIT: i now have this code working myself but don't know how you would want the demo, it could be updated: this godot video shows the steps to get the physics working and it will allow the demo to remove all the wrapper stuff

youtube vid:
https://www.youtube.com/watch?v=SXZu2NxSEWo&ab_channel=Chevifier

@RichardEllicott RichardEllicott changed the title godot-demo-projects/2d/bullet_shower /bullets.gd .... demo doesn't make any sense? bullets.gd .... demo code has issues, doesn't make any sense? Nov 27, 2024
@Calinou
Copy link
Member

Calinou commented Dec 2, 2024

The demo uses collision detection without physics. This is pretty much how CharacterBody (formerly KinematicBody) works, actually 🙂

A lot of oldschool games implement their character controllers in a similar fashion.

@RichardEllicott
Copy link
Author

RichardEllicott commented Dec 6, 2024

i can't see any manual detection in your code, we have a class object being moved around with a loop... then a drawing part... what line is the manual detection?

i solved this issue for myself anyway.... my demo spawns loads of physics circles and uses the server:

https://gist.github.com/RichardEllicott/3e7762f4c28190f8784123da1bc90030

if the example wanted to use rigid bodies please make use of my code it's just a waterfall, i should add a pool but it was all too slow for water anyway

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

2 participants