#RigidBodies
Explore tagged Tumblr posts
Text
Unveiling the Mysteries of Motion: A Review of Dynamics of Motion: Particles, Rigid Bodies and Gravitation
Available worldwide on Amazon platform in kindle, Paperback and hardcover. https://amazon.com/author/prashantkumarlal About the BookDynamics of Motion: Particles, Rigid Bodies and Gravitation is an enlightening guide into the intricate world of classical mechanics. With a meticulous approach, this book explores the fundamental principles of motion, delving into the behaviour of particles and…
View On WordPress
#ClassicalMechanics#EngineeringTextbook#Gravitation#MotionDynamics#PhysicsBooks#PhysicsBooks ClassicalMechanics MotionDynamics RigidBodies Gravitation PhysicsEducation STEMResources EngineeringTextbook#PhysicsEducation#RigidBodies#STEMResources
0 notes
Text
A set volume of water splashing about a container and around effectors/rigid bodies. More water VFX, and rendered in Blender.
1 note
·
View note
Text
when i was a kid i thought condemned 2 and manhunt 2 were the same game bc eyes
now i think they're boyfriends instead
5 notes
·
View notes
Text
Leah's Halloween Extravaganza: Eyeball animation!
heheheh procedural eyeball + rigidbody sim go brrr :)) Might post a softbody/fluid sim version another time
Animation taglist: @dungeonsandblorbos, @the-inkwell-variable, @thatuselesshuman, @trippingpossum, @tragedycoded,
@everythingismadeofchaos, @the-golden-comet, @xenascribbles, @blue-endy, @kaeru483,
@drchenquill, @satohqbanana, @possiblyeldritch, @badscientist, @real-fragments,
@rivenantiqnerd, @finickyfelix, @leave-a-message19, @illarian-rambling, @thewingedbaron,
@differentnighttale, @blargh-500, @kitkins13
#Tw jumpscare#my animation#Blender 3d#3d animation#Blender animation#Halloween#Eyeball#Leah's Halloween Extravaganza
35 notes
·
View notes
Text
Issues with Rigidbodies
help
41 notes
·
View notes
Text
I JUST FUCKING WANT WHEN A RIGIDBODY COLLIDES WITH ANOTHER COLLIDER IT CALLS A FUNCTION THAT HAS A REFERENCE TO THE COLLIDER IT COLLIDED WITH, WHY IS THAT SO FUCKING HARD FOR GODOT???
31 notes
·
View notes
Text
SotG #001
Howdy, I figured I'd start off the first State of the Game post of mine with some general statements about the game as a whole. Being in the early stages I've been primarily focusing on player mechanics. The player is going to use rigidbody mechanics to move around because I like using physics, it just feels like I have more control rather than the Character Controller component. It's been going well, took a while to add some smoothing when the player moves over slopes because I want them to remain a constant speed regardless if their moving uphill or downhill. Once this is all done I'm on to combat, which is going to be a doozy.
8 notes
·
View notes
Text
So while working on doors and such for my game, I initially wanted them to be like a physical object you'd have to grab and drag, but due to something something physics freaking out I ended up not doing that method and resorted to using a simple toggle animation system.
Until now : 3
Also! they're still not physical! its just a static body doing some interpolation stuff, not a rigidbody.
They also have some basic stuff such as latching to a open and close position, and ill prob still keep the option to simply toggle between the open and close position instead of having to drag, for convenience.
Soon ill also work on adding some sounds for them as well :)
6 notes
·
View notes
Text
Code Blog #4 I guess
I started on the Rat🐭 enemy, it's supposed to be the easiest since it just walks left and right like a goomba, but I said SUPPOSED 'cuz this was hell and it's not even working right.
Ok so what I did was I made the rat and such and then I added an area to identify if it bumped on a solid element so it could turn, simple right? WRONG
At first it was moving like crazy and I realized I hadn't set the RigidBody to "character" so that's why the physics were off, but then after I fixed that it REFUSED TO MOVE.
And that's where I am now, I'll try again tomorrow- or the day after.
Xoxo, gossip girl 💋
#game dev#codeblr#godot engine#if you see this please be nice#pixelart#platformer#indie games#god help us all
32 notes
·
View notes
Text
stupid game updates:
1) spent 15 minutes wondering why the hell my input wasn't working,, turns out i just had to click on the game scene for it to focus my input in the game and not the stupid editor,, anyways......... totally not wasting my time
2) i completely forgot that i should use the rigidbody for the movement instead of the gameobject's transform and also about the existence of ✨Fixed Update✨ (this is all magic words if you don't use unity)
3) all i did tonight was look at the screen and think to myself: "should i do it this way?" "should i do it that way??" "what is more efficient?" "is this code ugly??" "am i doing tile based movement like Pokemon??" "i like tile based movement let's do that" (doesn't know how to do tile based movement) "let's do continuous movement......" (nothing is moving yet)
that's it thank you besitos
6 notes
·
View notes
Text
rolling d20 for whatever reason
I was making meshes for VFX and exported an icosahedron just in case I'd need it. I thought that applying physics to it would make a d20 die, and was wondering how to make it functional to pass integer values. So I did that. But why? i have absolutely no use for dice in my game. There are no rolls. Why did I make this?
This might be the worst solution. What are vertex normals? I don't know. I used empty objects with sphere colliders and scripts holding numeric values for each face. When die stops spinning, a raycast from directly above hits the upwards facing face and gets the integer from the script. Physics is basic RigidBody with specified rotation and force applied on key press.
3D model and texture are from Sketchfab
3 notes
·
View notes
Text
youtube
was bored so I made a movement controller for bitgirl. I refuse to use rigidbodies so I had the angular velocity of the character controller calculated and clamped to have her lean into her turns.
4 notes
·
View notes
Text
Here's the script I wrote for the enemy's pathfinding and smooth rotation to the moving direction, feel free to use it or give me hints on how to make it better👇
extends CharacterBody3D
# references to Navigation agent and Markers I renamed as Points
@onready var agent = $NavigationAgent3D
@onready var point_1 = $"../Point1"
@onready var point_2 = $"../Point2"
@onready var point_3 = $"../Point3"
var speed = 5.0
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
@onready var current_target = $"../Point1"
func _physics_process(delta):
if not is_on_floor():
velocity.y -= gravity * delta
agent.target_position = current_target.global_position
var next_position = agent.get_next_path_position()
var direction = global_position.direction_to(next_position)
if direction:
velocity.x = direction.x * speed
velocity.z = direction.z * speed
else:
velocity.x = move_toward(velocity.x, 0, speed)
velocity.z = move_toward(velocity.z, 0, speed)
# Looking part, this controls both smooth rotation and looking direction.
var new_transform = transform.looking_at(next_position, Vector3. UP)
transform = transform.interpolate_with(new_transform, speed * delta)
move_and_slide()
# An ugly patrolling cycle where enemy goes from one point to another.
func _on_navigation_agent_3d_target_reached():
if current_target == point_1:
current_target = point_2
elif current_target == point_2:
current_target = point_3
elif current_target == point_3:
current_target = point_1
2 notes
·
View notes
Text
Shenanigans
I decided to instantiate and drop ~99 RigidBodies to see what would happen. The game had zero problems until I tried to interact with one of the boxes and my interaction system got fussy. Now that I think about it, I need to repeat this very important experiment with my bomb object...
5 notes
·
View notes
Note
Has no one asked how you made the eyeball yet?? I wanna know! I know nothing about Blender, so if you'd care to infodump about 3D animation while you're at it, you have a captive audience >:]
I already told someone about my favourite parts of making it, so you're getting all my least favourite parts! Buckle up because this is gonna take literally forever!
First off: I used this tutorial (because I'm just about getting the hang of geo nodes, still) to make the eye:
youtube
Now, you'll note that the thumbnail on the video shows veins, which would have been perfect for the horror vibes. Unfortunately, from the back, it looks genuinely ass :( So I had to get rid of them. This was only one of the many, many things that went horribly wrong in this event.
Now, I'd waited so long to try out geo nodes that half of the tutorial was outdated and yours truly ended up jury rigging the shader for the cornea, because the settings that they used no longer existed :/ which is why it doesn't look quite as shiny as it was meant to.
And then there was the glorious HDRI issue. the hdri is what provides the lighting and background of the animation, which would have been all fine and dandy, except I couldn't find any horror hdris. At least not free ones. So I had to take a random room and run it into Photoshop to turn it red.
Of course that was when I started finding issues with the animation. I wanted the eyeball to be a softbody, so it could be squishy, but for whatever reason every time I tried to turn it on, the eyeball itself would disappear.
So I decided to just go with rigidbody instead :/ I thought that I could maybe swap it out for some blood simulations instead but it nearly killed my poor laptop..
Unfortunately because of the shape of the cornea the damn eye kept trying to tilt at random angles so I had to disable the geometry nodes and pretended the eyeball was a perfect sphere for the simulation. Oh, and there was the time I forgot to save and my computer deleted several hours worth of work.
So yeah. That's how we ended up with this. Thanks for the ask, jamieeee
5 notes
·
View notes
Text
I dislike using rigidbodies to move my objects because physics interactions can sometimes go ham and while that can be very amusing, I prefer things to be predictable. So for moving arrows in this game I handled the movement math myself via coroutine. Let's take a look-see, shall we? :3
The goal of this coroutine is to move its symbol object in an arcing motion from its initial position, moving it upward and to either the right or left. Then it will fall downward. Rather than having each symbol object run this coroutine from an attached script, I am using a central script (my GameManager) to apply this movement to a given object, so the first thing I do is make sure the symbol still exists before proceeding with the coroutine:
If we find that our symbol has been destroyed, we exit the coroutine with "yield break". You wouldn't need this check if the script is running this movement on its own object, as coroutines are ended upon an object's destruction.
There are a bunch of variables we'll define within our coroutine to calculate our desired motion; we'll start by defining an arcDuration:
This determines how long the object will take to move in the arc shape. A shorter duration results in faster movement. Using a random amount between a min and max duration creates some variance in how fast different symbol objects will move. I have my minArcDuration set to 1 and maxArcDuration set to 2.5 for quick bouncy movements.
These variables referencing the outermost bounds of the camera's view will be used to ensure that symbols remain within the visible area of the camera at all times. I'm not using a topBound because I'm fine with symbols possibly going off the top of the screen, but I use a maxArcHeight variable that is set low enough that they never do.
For even more spawn variability, we add a little randomness to our starting point. My spawnPointVariance is set very low at 0.3; my initial symbol spawn position is low on the screen, and due to how the rest of this coroutine works, it's important that the symbols are never allowed to spawn below the bottomBound or else they will be instantly deleted (and result in a miss!)
The height here is, of course, how far up the symbol will travel, and the distance refers to how far it will move to the left or right. We calculate the peak of the arc by adding our distance and height to the x and y values of our starting position. Randomizing between negative and positive distance values for our x position adds another layer of variability which includes the possibility of moving either left or right, even though our minArcDistance and maxArcDistance are both set to positive values for clarity (mine are set to 1 and 6).
This is the part of the code that decides upon our symbol's speed by calculating the distance it has to cover from its start to its peak. By dividing our horizontalDistance by our arcDuration (distance divided by time), we calculate how fast the symbol needs to move to cover the entire distance in the given duration. Mathf.Abs is used to ensure that horizontalDistance is always positive, lest we get a negative value that causes us to move in the opposite of the intended direction.
We'll also want a speed variable for when the arcing motion ends and the symbol starts falling, that's where downwardSpeed comes in. In earlier versions of this function, I used downwardSpeed alone to transform the object's position, but I've since refined the logic to take the current horizontalSpeed into account for more consistent motion; we'll see that later. (Also you can see I've been tweaking that arbitrary range a bit... the fall speed was brutal during those mass waves ;o;)
Here we create an elapsedTime variable starting at 0. In our while loop, we will use this variable to count how much time has passed, and if it becomes greater than or equal to arcDuration, we'll change isFalling to true and begin moving down.
We create a Vector3 moveDirection which gives the vector pointing from the startPosition to the peakPosition, and then turn it into Vector3 horizontalDirection, which retains only the X-axis direction. Both values are normalized to ensure consistency. Without normalization, the magnitude (or distance) of the vector would vary depending on the distance between the start and peak positions, which could result in inconsistent speed. Normalization caps the magnitude at 1, meaning the vector represents just the direction, not the distance, allowing for consistent speed calculation later.
Here's how we start our while loop: as long as our symbol object is not null and the game says we canMove, we say yield return null, which will instruct our loop to occur every frame. If either the symbol becomes null or canMove becomes false, the while loop will end and so will the coroutine - for this reason, I only set canMove false when the game ends and the symbols will never have to resume movement, rather than in cases where I want them to pause movement and resume later, such as when a player pauses the game or during level-up periods. For the latter I use an isLevelingUp bool in my while loop that waits until that bool is false before proceeding (yield return new WaitUntil(() => !isLevelingUp)), and for the former I actually change the game Time.timeScale to 0, which is not typically recommend but fuck it we doin it live, because I don't have a mechanism for resuming this function with appropriate variables if it is stopped. It could surely be done if you just store the local variables somehow.
This is the first part of our movement logic that we put in the while loop; remember we already set isFalling false, so this part will proceed with the rising motion.
We count our elapsedTime here by adding Time.deltaTime, a variable which represents the time in seconds that has passed since the last frame, ensuring that time calculation is frame-rate independent. Do NOT use Time.time in cases like this unless you want your users with varying computer specs to all have different experiences with your game for some insane, villainous reason
The variable 't' is looking at the elapsedTime divided by arcDuration, a ratio that tells us how far along we are in the arc movement. If elapsedTime equals arcDuration, this ratio would be 1, meaning the arc is complete. We use Mathf.Clamp01 to clamp this value between 0 and 1, ensuring that it won't ever go higher than 1, so that we can use it to calculate our desired arcPosition and be sure it never exceeds a certain point due to frame lag or some such. If 't' is allowed to exceed 1, the arcPos calculation could possibly go beyond the intended peakPos. We are going for predictable motion, so this is no good
We define our Vector3 arcPos with Vector3.Lerp, short for "Linear Interpolation", a function for calculating smooth transition between two points overtime. Ours takes our startPos and peakPos and moves our symbol between the two values according to the value of 't' which is incrementing every frame with Time.deltaTime. As 't' progresses from 0 to 1, Vector3.Lerp interpolates linearly between startPos and peakPos, so when 't' is 0, arcPos is exactly at startPos. When 't' is 1, arcPos reaches peakPos. For values of 't' between 0 and 1, arcPos is smoothly positioned between these two points. Very useful function, I be lerping for days
Then we alter the y coordinate of our arcPos by adding a calculation meant to create smooth, curved arc shape on the y axis, giving our object its rounded, bouncy trajectory. Without this calculation, you'll see your symbols rising and falling sharply without any of that rounded motion. This uses some functions I am not as familiar with and an explanation of the math involved is beyond my potato brain, but here's a chatgpt explanation of how it works:
Mathf.Sin(t * Mathf.PI): This calculates a sinusoidal wave based on the value of t. Mathf.PI represents half of a full circle in radians (180 degrees), creating a smooth curve. At t = 0, Mathf.Sin(0 * Mathf.PI) is 0, so there’s no vertical displacement. At t = 0.5, Mathf.Sin(0.5 * Mathf.PI) is 1, reaching the maximum vertical displacement (the peak height of the arc). At t = 1, Mathf.Sin(1 * Mathf.PI) returns to 0, completing the arc with no vertical displacement. This scales the vertical displacement to ensure the arc reaches the desired height. If height is 10, then at the peak, the symbol moves 10 units up.
With those positions calculated, we can calculate the "newX" variable which represents where we want our symbol to appear along the x axis. It adds the horizontal movement to the current x coordinate, adjusted for the time passed since the last frame.
We use Mathf.Clamp to ensure our newX value doesn't exceed either the left or right bounds of the screen. This function limits the given value to be between min and max value.
Finally we tell our loop to actually reposition the symbol object by creating a new Vector3 out of newX, arcPos.y, and using our symbol's own z coordinate. That last bit is important to ensure your sprite visibility/hierarchy doesn't go out of whack! If I used arcPos.z there instead, for example, it's likely my sprites would no longer be visible to my camera. The z position the symbol spawned at is the z position I want it to retain. Your needs may vary.
This part tells us our arcDuration should end, so we set isFalling to true, which will cause the secondary logic in our while loop to trigger:
Previously, objects retained their x position and only had negative downwardSpeed applied to their y position, but I didn't like that behaviour as it looked a little wonky (symbols would reach their arc peak and then suddenly stop and drop in a straight line downward).
By creating a new Vector3 fallDirection that retains the horizontalDirection and horizontalSpeed from the arc phase, we're able to apply smooth downward motion to the symbol that continues to the left or right.
Just below that, we once again clamp the symbol's x position to the left and right screen bounds so the symbols can't travel offscreen:
The loop would continue causing the symbols to fall forever if we didn't have this check:
which triggers some project specific logic and destroys the symbol, then exits the coroutine with "yield break". Although the coroutine already exits when the symbol becomes null, which it will see is the case in the next frame as we destroyed the symbol here, adding an explicit yield break is an added layer of security to ensure predictability. Once again, not super necessary if you decide to run this code from the moving object itself, but just be sure you move your Destroy() request to the bottom of any logic in that case, as nothing after that point would be able to trigger if you destroy the object which is running the coroutine!
and that's all folks. If this helps you make something, show me!
HEY, did you really make it all the way to the end of this post?! ilu :3 Do let me know if this kind of gratuitous code breakdown interests you and I will summon motivation to make more such posts. I personally like to see how the sausage is made so I hoped someone might find it neat. If ya got any questions I am happy to try and answer, the ol' inbox is always open.
#gamedev#solodev#made with unity#c sharp#tutorial#coding#programming#clonin game#code explanation#code explained
2 notes
·
View notes