Discuss Scratch
- ResExsention
- New Scratcher
1000+ posts
Adding Physics
There's various different forms of gravity in physics engines that could be implemented.
Quadratic gravity (velocity increases by a constant each frame)
Cubic gravity
Exponential gravity
etc. you name it, all sorts of functions,
not to mention each of those may have modifications like terminal velocity, etc.
Alright, I'm not a physicist.
Again, would dropdowns work?
Infrequently active.
It feels weird to see how far we've come. I hope you're well, wherever you are!
- taopage
- Scratcher
72 posts
Adding Physics
To have the physic, write griffpatch.guitub.io/scratch-gui/ dans recherche google
- ResExsention
- New Scratcher
1000+ posts
Adding Physics
To have the physic, write griffpatch.guitub.io/scratch-gui/ dans recherche google
I don't understand.
You want us to search it up on Google?
Infrequently active.
It feels weird to see how far we've come. I hope you're well, wherever you are!
- 45afc4td
- Scratcher
100+ posts
Adding Physics
No. That wouldn't work because there are infinitely many functions, and it's impossible to select an arbitrary one with dropdowns. I already voted for no support, as it doesn't make sense for physics to be a single operation, it's better for Scratchers to implement that themselves or use existing code, because that's how programming actually works.There's various different forms of gravity in physics engines that could be implemented.
Quadratic gravity (velocity increases by a constant each frame)
Cubic gravity
Exponential gravity
etc. you name it, all sorts of functions,
not to mention each of those may have modifications like terminal velocity, etc.
Alright, I'm not a physicist.
Again, would dropdowns work?
- coder2045
- Scratcher
1000+ posts
Adding Physics
The point of Scratch is to make things yourself. Also, there are too many unclear things. Which shapes would count as walls? What if a shape fell off the screen? Griffpatch made a physics engine for Scratch, and I love it. It would be incredible if this was added to the actual Scratch. I mean, just think of all the possibilities it would add. We could make a realistic Angry Birds game with this, and adding physics to our projects would be much simpler
I think physics blocks should be one of the ‘extras’ like translation, pen, music, etc. I love the idea of being able to program physics on Scratch in a much more simpler way! Making Angry Birds is probably my favorite thing you could make with this.
If you want to check out griffpatch's physics extension, go to this link:
https://griffpatch.github.io/scratch-gui/
and be sure to watch this video to figure out how it works:
https://www.youtube.com/watch?v=WzFhOlY7Ul8
More suggestions may be added to this thread.
Highlight this text and press Ctrl-Shift-Down to view more of my signature. There's a lot in there.
I FOUND THE POSTIE POSTIE POST LINK THIS
Brainteaser: What comes next? Answer on my profile. First correct answer gets a follow.
[ ]
[ [ ] ]
[ [ [ ] ] [ ] ]
Good projects ⬇️
- Sheep_maker
- Scratcher
1000+ posts
Adding Physics
There is only quadratic gravity; on an ideal planet the acceleration due to gravity is constant for all objects, and acceleration is best modelled quadratically. Terminal velocity isn't necessary on Scratch because of how small the stage size is There's various different forms of gravity in physics engines that could be implemented.
Quadratic gravity (velocity increases by a constant each frame)
Cubic gravity
Exponential gravity
etc. you name it, all sorts of functions,
not to mention each of those may have modifications like terminal velocity, etc.
I think this block could just be
set gravity to (9.8) towards direction (270)::extension // sample number and angleNumber inputs give the most functionality, though they may not be the most intuitive
- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
- 45afc4td
- Scratcher
100+ posts
Adding Physics
No. It is up to the project to decide how gravity behaves. As such, the programmer decides how should the gravity change with time. It is not necessarily a reflection of the actual, physical gravity. If it was, the block would have to have an input for the point of the center of the gravity.There is only quadratic gravity; on an ideal planet the acceleration due to gravity is constant for all objects, and acceleration is best modelled quadratically. Terminal velocity isn't necessary on Scratch because of how small the stage size is There's various different forms of gravity in physics engines that could be implemented.
Quadratic gravity (velocity increases by a constant each frame)
Cubic gravity
Exponential gravity
etc. you name it, all sorts of functions,
not to mention each of those may have modifications like terminal velocity, etc.
I think this block could just beset gravity to (9.8) towards direction (270)::extension // sample number and angleNumber inputs give the most functionality, though they may not be the most intuitive
- Sheep_maker
- Scratcher
1000+ posts
Adding Physics
If the programmer wants gravity to deviate from how acceleration and velocity works, then they aren't looking for a physics engine.No. It is up to the project to decide how gravity behaves. As such, the programmer decides how should the gravity change with time. It is not necessarily a reflection of the actual, physical gravity. If it was, the block would have to have an input for the point of the center of the gravity. snip
Anyhow, there are physics libraries outside of Scratch; I think griffpatch used a JavaScript port of Box2D, which is fairly popular. We can look to them to see how they deal with these oddly specific needs and mimic their design principles in a Scratch extension, especially if the extension uses the library too
It seems according to here Box2D also does what my suggested block would do for specifying gravity:
b2Vec2 gravity(0, -9.8); //normal earth gravity, 9.8 m/s/s straight down! bool doSleep = true; b2World* myWorld = new b2World(gravity, doSleep);
- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
- 45afc4td
- Scratcher
100+ posts
Adding Physics
physics engine.If the programmer wants gravity to deviate from how acceleration and velocity works, then they aren't looking for a
physics isn't used to refer to actual physics. physics (short for platforming physics) is used to broadly refer to the platforming physics engine in video games, which doesn't have to follow actual physical gravity. While many games do have constant acceleration and terminal velocity, this formula need not be a part of a platformer with gravity, as it doesn't have to be actually realistic. A game of Tetris for example normally has linear gravity or step linear gravity. To achieve that, the physics engine of a game of Tetris should not follow quadratic gravity but rather implement the linear gravity or step linear gravity. Or a high gravity mode in a video game would switch from quadratic gravity to cubic gravity.
- Is_You_Me_isaiah
- Scratcher
3 posts
Adding Physics
There is a fairly easy way, but there are MANY problems. Here it is!:
when green flag clicked
forever
change y by (-10)
end
when green flag clicked
forever
if <touching color [] ?> then
change y by (10)
end
end
If you know how to make the sprite, or player move, this is all you need to know!
Last edited by Is_You_Me_isaiah (Jan. 19, 2020 21:52:43)
- --Explosion--
- Scratcher
1000+ posts
Adding Physics
No offense, but this isn't real physics and it is not a workaround for most of the blocks in griffpatch's physics extention. There is a fairly easy way, but there are MANY problems. Here it is!:when green flag clicked
forever
change y by (-10)
endwhen green flag clickedforever
if <touching color ?> then
change y by (10)
end
end
If you know how to make the sprite (player) move, this is all you need to know!
- Ryanrobinson0
- Scratcher
5 posts
Adding Physics
You can do this. It's an easy version
when green flag clicked
forever
if <not <touching [ Grass, platform, or anything...] ?>> then
change y by (-5)
- Ryanrobinson0
- Scratcher
5 posts
Adding Physics
This is way easy for physics. It can take like 1 minute/60 secs probably.
when green flag clicked
forever
if <not <touching [Grass] ?>> then
change y by (-5)
- Realproject
- Scratcher
7 posts
Adding Physics
Is physcs are really added if then i really want it to make my awsome platformers and and all projects call gravity physics are gone too
Please scratch make that happen
Thank you
#scratch
Please scratch make that happen
Thank you
#scratch
- Tdth
- New Scratcher
10 posts
Adding Physics
Or, with a gravitational list: This is way easy for physics. It can take like 1 minute/60 secs probably.when green flag clicked
forever
if <not <touching [Grass] ?>> then
change y by (-5)
(in Scratch pseudocode)
[counter v] = [0] ::variables stack
forever
frame::custom
wait(0)secs
end
define frame
[counter v] += [1] ::variables
change y by (item (counter) of [gravity v])
if<collision::custom>then
while<collision::custom>then {
change y by [1]
}::control
[counter v] = [0] ::variables stack
end
Last edited by Tdth (Feb. 18, 2020 16:24:42)
- --Explosion--
- Scratcher
1000+ posts
Adding Physics
Please don't blockspam, instead contribute your ideas to this conversation.move (343) steps
- Realproject
- Scratcher
7 posts
Adding Physics
Sorry i was just seeing how it works also how do i reply
Hey are u excited if scratch added the physics extention it would be so awsome
define
[/#scratch ]
- Realproject
- Scratcher
7 posts
Adding Physics
I also want scratch to fix some bugs for mobile devices