Advertisement

curving projectiles and center of mass, not the usual ?

Started by December 16, 2002 03:30 AM
13 comments, last by RolandofGilead 22 years, 2 months ago
1) I''m doing a game with some 2d space ships firing some beams, and it would be much easier to treat them as straight lines, but the ships can be accelerating and the beams can be spun around. Is there a fast, easy way to deform the beam. Yes, linear velocity does equal radius times angular velocity. There are also projectile weapons, but they travel at the same speed as the beams, so if the beams are treated as straight lines there may be instances when things won''t look right, like if a ship is *accelerating* forward while firing a beam and projectile weapon to the side, the two won''t curve the same if I treat the beams as straight lines. Any suggestions for how to alleviate this problem? 2) Say we have a 3d model(a bunch of points that define the outer surface of an object), if it has uniform density, under what conditions will its center of mass not be the average of the vertices? Would it work if you took the midpoint of every polygon and averaged them out, provided that every polygon has equal area? And I don''t know why this idea popped into my head, but would it be accurate to average out the position of all the midpoints of lines created by drawing a line between each vertex and all other vertices? Although I''m not sure if duplicate lines should be counted and/or if one should discard all lines that are already formed with the vertex.
What do you mean by the beams "curving"? Aren''t the beams an instantaneous release of energy? I''ve never seen a curved beam, and I watch plenty of Star Wars I really can''t say I know what you mean.

quote:
2) Say we have a 3d model(a bunch of points that define the outer surface of an object), if it has uniform density, under what conditions will its center of mass not be the average of the vertices?

Well, if it''s uniform density, the only way the center of mass won''t be the average of the points is if there isn''t uniform volume, but I''ve never heard of volume being multiform, so...

quote:
And I don''t know why this idea popped into my head, but would it be accurate to average out the position of all the midpoints of lines created by drawing a line between each vertex and all other vertices? Although I''m not sure if duplicate lines should be counted and/or if one should discard all lines that are already formed with the vertex.

I don''t see what good that would do. You''d be better off averaging the original vertices themselves.
Advertisement
quote:
2) Say we have a 3d model(a bunch of points that define the outer surface of an object), if it has uniform density, under what conditions will its center of mass not be the average of the vertices? Would it work if you took the midpoint of every polygon and averaged them out, provided that every polygon has equal area?


Not in general. A surface with a lot of grooves and creases will shift the centre of mass towards it in your model, while in reality the opposite i true.
quote:
Original post by Zipster
What do you mean by the beams "curving"? Aren''t the beams an instantaneous release of energy? I''ve never seen a curved beam, and I watch plenty of Star Wars I really can''t say I know what you mean.


No, a pulse is an instantaneous release, a beam is a continuous release. The only beams in Star Wars are the lower gun turrets on a Republic troopship and the ''helper'' beams on the Death Stars, even the main shot of the Death Stars is a pulse albeit longer than average.

Beams curve, v = r omega, take a water hose and change the direction as it sprays, and look down the hose as you do it.
quote:
...look down the hose as you do it.

lol hey just because he didnt answer your question right doesnt mean you should play a mean trick on him...jk

to address your problem-
energy (electromagnetic waves really) tends to move at the speed of light. You would not notice the curvature unless you were quite a ways away (it travels about 299,792,458 m/s)
but maybe you want a special effect? This would be strange however because if the beam acted as a fluid volume it would have to be low speed...which doesnt sound like any scifi weapons i''ve seen in a game. as for a solution...your current problem will require a hack...you''ll have to cheat because mathematically...it doesnt add up...sorry i know i didnt answer your question like you wanted, but i hope i gave a different point of view

Brian
Brian J
1) If you mean that the beams are curving back because they are shot while you are accelerating, they wouldn''t curve back if they are light/laser beams because according to Einstein the speed of light is constant to any observer. Am I right in supposing that in your game the beam acts like a projectile? Maybe you could program your beams instead as a large number of projectiles being shot out - if you alpha-blend it together it might look like a beam and also curve the way you want it to. Although if your beams travel very fast then it probably doesn''t matter.

2) You need to do something like take the average of ALL the points that are contained within the model. I''m not sure how this can be done. Maybe you could make a 3-dimensional array of points (sort of like ''voxels'') and check if each point is in the model, and average all the points that are. This would be extremely difficult though.

Firebird Entertainment
“[The clergy] believe that any portion of power confided to me, will be exerted in opposition to their schemes. And they believe rightly: for I have sworn upon the altar of God, eternal hostility against every form of tyranny over the mind of man” - Thomas Jefferson
Advertisement
quote:
Original post by RolandofGilead
2) Say we have a 3d model(a bunch of points that define the outer surface of an object), if it has uniform density, under what conditions will its center of mass not be the average of the vertices? Would it work if you took the midpoint of every polygon and averaged them out, provided that every polygon has equal area?


Heh heh heh. Um, see here for an exhaustive (and exhausting) discussion of the topic. The short answer is: an object's gravitational pull is not coincident with its center of mass. The simple reason is that the center of mass is proportional to distance, whereas the force of gravity is inversely proportional to the square of distance.

If you split an object up into pieces, like you suggest, and sum all the vector gravitational pulls, you should get a decent approximation. If your polygons were infinitely small, you'd get the absolute correct answer.

quote:

And I don't know why this idea popped into my head, but would it be accurate to average out the position of all the midpoints of lines created by drawing a line between each vertex and all other vertices? Although I'm not sure if duplicate lines should be counted and/or if one should discard all lines that are already formed with the vertex.

No. The distance from the object is _the_ most important thing--any kind of 'average' would be worthless unless the polygons were dynamically weighted by their distance--and at that point you might as well just do the whole calculation.

If you want a quick way of doing this, you might just choose a "gravity horizon" and only caluculate gravity up to a certain amount away from the object--since these are projectiles which are already in motion, the approximation might be valid.

[edited by - Stoffel on December 16, 2002 12:54:20 AM]
quote:
There are also projectile weapons, but they travel at the same speed as the beams



speed of my beams != speed of light(not even close)

Thank you Tron3k for getting that and treating a beam as a stream of particles does make some things easier.

I think even light beams do bend a little when arcing though, if someone has a high-powered flashlight(lantern) and a dark night and would go outside and swing it back and forth so the beam is in the air(because you have to be able to see the beam at a distance to see this effect). Of course my memory of seeing a flashlight beam do that could be off. But it definitely works with a hose.
quote:

I think even light beams do bend a little when arcing though, if someone has a high-powered flashlight(lantern) and a dark night and would go outside and swing it back and forth so the beam is in the air(because you have to be able to see the beam at a distance to see this effect). Of course my memory of seeing a flashlight beam do that could be off. But it definitely works with a hose.


ummm...no a lightbeam moves faster that you can see...like i said earlier you'd have to be about 300 million meters away to see the slightest curve...a hose yes but the velocity of the water in a hose is probably around 3-4 meters per second...im sure it could be a cool effect but im just saying in real life it doesnt work...anyone agree with me? A stream of particles sounds to me like the best idea to do it like a hose, because the reason for the curve there is that the first particles sprayed were going in that direction, and they keep going that way, and the new ones go in the direction the hose is pointing...so its not really a continous beam but a fluid particle system...

Brian
EDIT:
quote:

speed of my beams != speed of light(not even close)

Ok, missed that...but still...the difference between 300 million and 3 is IMMENSE
a bending effect probably would not be seen in an energy beam is all im saying...that said...it would be a cool effect!

[edited by - bjmumblingmiles on December 17, 2002 12:33:37 AM]
Brian J
What are your beams made of? It''s quite hard to visualise a beam travelling slow enough to not be a straight line. Compared to your projecticles would a beam just be a steady flow of these to make a beam?

This topic is closed to new replies.

Advertisement