PDA

View Full Version : Need an equation for a magic mechanic



jseah
2010-03-29, 10:03 PM
[Warning: Catgirl murdering ahead]
First off, this will be quite geeky and not suitable for normal gaming. It also involves a system that I have been working on for two years so it's not about to change into something more playable.

I need an equation that describes the magnitude of rotation imparted to an object by converting linear motion. I would like this to conserve kinetic energy if possible, or have some relation to it's conservation if an approximation is used.

I've been trying on and off for the past month now and seem to be stuck on it. For reference, the kind of equation I wish I had looks something like this:
Change Movement Direction
Mp cost of 5 degree change per second: Speed (m s-1) x total mass (kg) per object

The functions can use + - * / and ^2, but try not to involve square roots or anything more complicated than that. I can't seem to do one without square roots in and I would like to not use them.

Request: an equation for...
Spin
Mp cost per second to convert 1m/s motion into rotation, per second: Function(based on mass of object)
Final rotation speed: Function(based on amount of speed converted) + original rotation speed

I only need to add to rotation speed since I have decided that it will only increase/decrease existing rotation directly and not change it's angle.

The function needs to have an inverse since it will be expected to work in both directions (converting spin back into motion, and cost the same for the same amount).
It will also need to cost more to convert all motion into spin and back than it takes to do a 180 change in motion but that's optional. (since it's easy to change by tacking on a fixed multiplier)

Many many thanks in advance, and I will undoubtedly go "why it was so simple!" >.>

Technically, this is exactly the same as the Change Direction function since making the object constantly change movement direction in an arc smaller than the size of the object makes it spin.

The definition of an object has been worked out to a certain extent. Got some bugs to figure out so this might need to be applied in unexpected ways.

Jack of Spades
2010-03-29, 11:35 PM
Useful physics be here. (http://farside.ph.utexas.edu/teaching/301/lectures/node104.html)

Thats the closest thing I could find to the English you and I speak. :smalleek:

cherez
2010-03-29, 11:56 PM
Before I attempt, a preamble:

I'm assuming you don't care about conservation of momentum, because your other example plainly violates it. If you do care, your spell will need two targets.

Kinetic energy of rotation is a lot harder than linear motion. I mean Calculus 3 versus algebra 1 here. I will go with a simple example of a uniform sphere. This doesn't even begin to resemble a close approximation in many cases, but if it's not good enough, let me know.


Even with those limitations, the simplest I can give you is:

(current rotation) = w
(current speed) = v
1 m/s into rad/s = - w + sqrt(w^2 + (20 * v - 10) / R^2) / 2

Sorry if you were hoping for clean. :smallfrown:

jseah
2010-03-30, 12:10 AM
Yes, conservation of momentum isn't followed. (This is the 'spell that breaks conservation of momentum'. The 'spell that breaks conservation of energy' is something else and is already done)

I did think of using a sphere =stupidly poor= approximation (didn't feel like calculating the moment of inertia for objects)
and ended up with an equation that looked a bit like yours (did it in full rotations per second, so might have looked a bit different)

=/ So there's really no way huh. Then again, if the definition of kinetic energy of rotation involves squares and square roots, there's no way I'm going to be able to get around it right?

Jack of Spades
2010-03-30, 12:24 AM
Well, you can always get around it by coping out and saying "It's MAGIC!!!" :smallbiggrin:

jseah
2010-03-30, 12:28 AM
Well, ok, if you allow the non-conservation of kinetic energy, it can be made simpler.

So if I take that out, perhaps something could be cooked up from this other idea:
The fastest spinning part has the same velocity as the original linear velocity.

Based off the cost for 5* change per second and the size of the object, something could be created from uniform circular motion I think.

jseah
2010-03-30, 04:19 AM
Oh actually, this could be made simpler. If you make the motion on one half of the object rotate 180*, then you have the object spin. Simple!
(Due to the way the bits of the object on the inside aren't supposed to be moving that fast, this would put strain on the object, time to write in incidental damage)

Cost for that would be as if rotating half the object's speed through 180*...:
18 * speed * total mass

Doing that to 1m/s per second would simply take speed out and you get 18 * total mass.

Horrible horrible approximation but better than doing square roots (it's a uniform rigid rod and you make it spin along an axis perpendicular to the rod, and no compressive loss in kinetic energy)
I'll just have to magic away the differences.

Added rotations per second: pi * radius * radius / (2 x total speed converted)
- Using the assumptions, the object should distribute it's speed to retain momentum, thus ends will be moving twice as fast as the original speed
- I could probably approximate pi to 3 and it wouldn't make a difference since the assumptions are so horrible anyway.