Rate of forward motion from rolling rectangle vs degrees turned

Click For Summary
SUMMARY

The discussion focuses on deriving formulas to calculate the forward motion and vertical displacement of a rolling rectangle as it turns. The primary formula proposed for horizontal movement is Δx = Δ(rotational position) × (b + (a-b)/2), where 'b' and 'a' represent the dimensions of the rectangle. For vertical displacement, the formula Δy = -r(1 - cosθ) is suggested, indicating that the center of the rectangle moves along a circular arc during rotation. The conversation emphasizes the importance of using radians for accurate calculations and the need to consider the rectangle's orientation during movement.

PREREQUISITES
  • Understanding of basic geometry and trigonometry
  • Familiarity with radians and degrees in angular measurement
  • Knowledge of rotational motion principles
  • Experience with programming concepts for game development
NEXT STEPS
  • Research "Rotational Motion in Physics" for foundational concepts
  • Learn about "Trigonometric Functions in Game Development" for practical applications
  • Explore "Calculating Circular Motion" to understand arc movement
  • Investigate "Using Radians vs Degrees in Calculations" for precision in programming
USEFUL FOR

Mathematicians, physics students, game developers, and anyone interested in understanding the mechanics of rolling objects and their motion dynamics.

  • #31
O ok!

In the first corner, Δx is positive as x shrinks from r to 0 and as θ increases from 0 to π/2, and in the second corner Δx is positive as x grows from 0 to r and as θ shrinks from π/2 - 0 to π/2 - π/2!

I'll have to think about the implications of this on my formula...

And the reason I was using capital Θ is negligence. I'm kind of reentering the world of math via programming, and that means I bumble around a bit.
 
Last edited:
Physics news on Phys.org
  • #32
brimby said:
O jeez. I didn't realize there is a calculus component that I hadn't even made it to yet.

So you're telling me a that it's much more complex than just:

Δx = r(Δcosθ)
Δy = r(Δsinθ)

for the first quarter turn??
No, the first quarter turn is easy. I'm saying there is a general formula, not too complicated, for the y movement; once you have that you can write down an integral for the general x movement, but since the integrand contains the modulus function it is not integrable into a closed form. Still worth getting to, though, because it will show you what the general x movement looks like.
I've attached graphs of x and y against theta for phi = pi/12
 

Attachments

  • rolling rectangle.jpg
    rolling rectangle.jpg
    13.8 KB · Views: 416
  • #33
brimby said:
In the first corner, Δx is positive as x shrinks from r to 0 and as θ increases from 0 to π/2, and in the second corner Δx is positive as x grows from 0 to r and as θ shrinks from π/2 - 0 to π/2 - π/2!

i think you're using θ to mean the total angle through which the rectangle has turned

i'm using θ to mean the angle from one diagonal's position to the next, eg on the first turn from θ = φ to θ = φ + π/2

that means i can use rcosθ and rsinθ

you would have to use rcos(θ + φ) and rsin(θ + φ)
 
  • #34
No I think we're doing the same. I'm just considering \varphi to be 0 and therefore θ = 0. I'm just setting the axis to go through the center diagonal of the rectangle. Is that okay?

Hmmm... maybe not. Cuz then it wouldn't be sitting flat at the end of the turn, and that would cause further problems...
 
  • #35
Ok I think I have the φ issue squared away. I think I really just have one last hurdle here, and it has to do with making things easier for programming.

Generally I am working with Δvalue because it's way easier for me to program things to change an amount from where they're at, rather than figure out where they are, where they need to be, and subtract. So I directly manipulate the Δvalue, and the new position is a product of the calculation. For example, if I am pressing the right arrow on the keyboard, the game character's xVelocity (variable) becomes 5, and after every refresh, the program is instructed to add the xVelocity to the xPosition, creating movement for the character over time.

But in the case of Δcosθ, it's all backward. I am directly affecting cosθ (well, mostly directly. By way of θ, at least) and then Δcosθ would need to be calculated out of that. What I really need is the relationship between Δθ and Δcosθ, so I can say "(cosThetaVelocity (Δcosθ)) = (rotationalVelocity (Δθ) altered by some constant), or put another way, "as the angle of θ changes, the value cosθ changes by some amount."

I feel like I should be able to get this part on my own, but I must be burnt out or something because I'm just going in circles and disorienting myself with trying to straighten out this seemingly simple relationship.

Hmmm... something just occurred to me. Maybe I should just turn the whole thing around and have the Δcos/Δsin values directly affected by the player's actions rather than Δθ. That would put it more in the direction I'm used to working. I'm still interested in what you have to say about how I framed it first though, because for all I know at this point, doing it that way would reverse some other thing that would screw me over.

Thanks a billion for all the help. I know this knowledge is going to help me over and over as I make games.
 
  • #36
brimby said:
… What I really need is the relationship between Δθ and Δcosθ, so I can say "(cosThetaVelocity (Δcosθ)) = (rotationalVelocity (Δθ) altered by some constant), or put another way, "as the angle of θ changes, the value cosθ changes by some amount."

no such formula exists …

Δcosθ/Δθ changes (it depends on θ)
… Maybe I should just turn the whole thing around and have the Δcos/Δsin values directly affected by the player's actions rather than Δθ. That would put it more in the direction I'm used to working. I'm still interested in what you have to say about how I framed it first though, because for all I know at this point, doing it that way would reverse some other thing that would screw me over.

i don't understand what the player would be doing :confused:

wouldn't he normally either want to push the box a given distance, or hit it with a given force?

why would he want to specify an angle?
 
  • #37
You know what, scratch that whole last ramble. I've decided that switching the directly affected values to Δcos and Δsin is definitely the way to go. It doesn't make sense that the character hits the rectangle and its degrees of rotation is what is directly affected. The forward motion of the attack doesn't translate into rotation, the amount it moves up and forward is what is actually being directly affected. It's going to add a whole 'nother layer to the physics where I have to calculate at what point the object lifts off the ground rather than keeps it's corner planted and rotates, but I want that level of richness to the physics, no matter how long it takes me to work through it. ;)
 
  • #38
tiny-tim said:
why would he want to specify an angle?

Yeah, that's my problem. I was saying "the rotationVelocity (Δθ) of the object is equal to the attackVelocity of the player" but there is no reason why that would directly translate. I need to make the attackVelocity affect the x and y velocity of one side of the rectangle, and calculate the θ from that.
 
  • #39
brimby said:
Yeah, that's my problem. I was saying "the rotationVelocity (Δθ) of the object is equal to the attackVelocity of the player" but there is no reason why that would directly translate. I need to make the attackVelocity affect the x and y velocity of one side of the rectangle, and calculate the θ from that.

what is the player hitting the block with?

anyway, it looks as if you'll need to use moments of force, and moment of inertia, about the forward edge, so as to find the initial speed of rotation after each hit

(if you don't know what those are, you've a lot of reading, and worked examples, to get through)
 
  • #40
brimby said:
but I want that level of richness to the physics, no matter how long it takes me to work through it. ;)

But don't worry, once I finally get through this initial exercise, I'm going to give the rectangle (and the people of this forum) a break and work on some other stuff for a while.
 
  • #41
tiny-tim said:
(if you don't know what those are, you've a lot of reading, and worked examples, to get through)

Noted. For now I'll probably just cheat and set Δx and Δy equal to some constant.

I'll work on the block tipping properties next. I've noticed there are some good discussions already laid out on that at this forum.
 
  • #42
brimby said:
You know what, scratch that whole last ramble. I've decided that switching the directly affected values to Δcos and Δsin is definitely the way to go. It doesn't make sense that the character hits the rectangle and its degrees of rotation is what is directly affected. The forward motion of the attack doesn't translate into rotation, the amount it moves up and forward is what is actually being directly affected. It's going to add a whole 'nother layer to the physics where I have to calculate at what point the object lifts off the ground rather than keeps it's corner planted and rotates, but I want that level of richness to the physics, no matter how long it takes me to work through it. ;)

Sounds to me like you're redefining the problem. The version in the OP is no longer relevant, right?
But I'm unclear what the new definition is. (Perhaps a new thread is appropriate.)
Are you trying to model a rectangular block being hit and sent rolling and bouncing? Do you want it to obey the normal laws of physics?

Fwiw, the solution to the OP is of the form y = A(sin(φ)|cos(θ)| + cos(φ)|sin(θ)|), and x = ∫y.dθ.
 
  • #43
haruspex said:
Are you trying to model a rectangular block being hit and sent rolling and bouncing? Do you want it to obey the normal laws of physics?

Yes.
 
  • #44
In that case, your main problem is detecting and handling the bounces.
At the instant before a bounce, you have the horizontal and vertical positions, the horizontal and vertical velocities, and the rotational velocity. You need to calculate the three resulting velocities.
Do you want to take friction into account? I'll assume not, for now.
At bounce, there is an impulse normal to the surface. There will be loss of energy. You'll need to choose a coefficient of restitution.
 

Similar threads

  • · Replies 116 ·
4
Replies
116
Views
13K
  • · Replies 23 ·
Replies
23
Views
3K
  • · Replies 1 ·
Replies
1
Views
9K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 19 ·
Replies
19
Views
3K
Replies
3
Views
10K
  • · Replies 40 ·
2
Replies
40
Views
5K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 4 ·
Replies
4
Views
2K