View unanswered posts | View active topics It is currently Wed Jan 08, 2025 4:58 am



Reply to topic  [ 11 posts ] 
 How do you make something travel along a projected arc? 
Author Message
User avatar

Joined: Tue Jul 21, 2009 4:36 am
Posts: 347
Location: The place where asses go to be bad
Reply with quote
Post How do you make something travel along a projected arc?
I remember figuring out how to project an arc using capnbub's artillery sighting script, but could I have someone tell me how to make something travel along said arc?

Thank you.


Tue May 25, 2010 11:34 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: How do you make something travel along a projected arc?
I think it's the opposite. It isn't made to fire the projectile along the arc, it's the arc is made to show the projectile's trajectory.


Tue May 25, 2010 11:42 pm
Profile
User avatar

Joined: Tue Jul 21, 2009 4:36 am
Posts: 347
Location: The place where asses go to be bad
Reply with quote
Post Re: How do you make something travel along a projected arc?
I understand, but that is why I am asking if you can make the projectile move along the projected arc.


Tue May 25, 2010 11:49 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: How do you make something travel along a projected arc?
Well, you could do something like my Boomerang mod (the draw mode), where a bunch of vectors for positions are stored in a list and the projectile goes through each point.


Wed May 26, 2010 12:25 am
Profile
User avatar

Joined: Tue Jul 21, 2009 4:36 am
Posts: 347
Location: The place where asses go to be bad
Reply with quote
Post Re: How do you make something travel along a projected arc?
I appreciate your help, I almost forgot that your boomerangs use a linear version of what I'm looking for!

(PS: if anyone has any different ideas on how to make this work, please post!)


Wed May 26, 2010 12:35 am
Profile
User avatar

Joined: Mon Jun 29, 2009 2:40 am
Posts: 610
Location: Deep below The Map of Mars
Reply with quote
Post Re: How do you make something travel along a projected arc?
If you only care about arcs in the vertical plane, you can simply tune the relevant gravitational acceleration of the particle.
That is to say, all particles follow an arc. They are all accelerated by the engine's gravity, and you may manipulate the variable in the INI code of the particle. If you want a small arc the number should be of greater amplitude, positive will go down, negative will go up. The variable is "GlobalAccScalar" and the default is, I think, 1 (CC's engine is strange, in the real world it would be 9.8).

I've made a mortar that used calculus to fire projectiles at a target, by taking the destination and deriving the angle at which you must fire to hit it. I believe the Gunship mod has a mortar which does the same thing (though more complex, and not human controlled).
The important things to know about for planning an arc are the fire velocity, angle, and gravitational acceleration. With these things and a little math, it is pretty easy to work out where the particle will go.

If you want an arc that goes out and returns, the boomerang mentioned above is a great place to start, as well as the "sine gun" made as a proof of concept. You could also use the homing missile, and give it a set of targets (similar to the boomerang).


Last edited by PhantomAGN on Wed May 26, 2010 1:22 am, edited 1 time in total.



Wed May 26, 2010 1:14 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: How do you make something travel along a projected arc?
The GlobalAccScalar variable isn't setting the gravitational acceleration to a specific number really, it's more like the percentage of gravitational pull the object will feel. 1 is full effect of gravity, 0.5 is half, ect.

Edit: The actual gravitational acceleration is defined in scenes.


Wed May 26, 2010 1:21 am
Profile
User avatar

Joined: Tue Jul 21, 2009 4:36 am
Posts: 347
Location: The place where asses go to be bad
Reply with quote
Post Re: How do you make something travel along a projected arc?
@PhantomAGN: Calculus, you say? Are we talking simple trigonometric calculus, or the more advanced material? Could you post some code similar to the one for your mortar? That would greatly help me.

@Cricket: Correct, but I belive the GlobalAcceleration can be changed in a lua script attached to the scene/mission (correct me if I'm wrong, the value could be permanent throughout the game).

BTW: What I'm working on is to greatly improve the "late" Ork-Gothic's Space Marines, starting with the Assault marine. The planned Assault Marine can make an "Assault Jump", which is basically where you choose an arcing trajectory (like in capnbub's artillery) and the actor launches itself along this trajectory slamming into the ground at the other end and generating a repulsive/concussive blast (It's supposed to somehow live through this).


Wed May 26, 2010 1:31 am
Profile
User avatar

Joined: Mon Jun 29, 2009 2:40 am
Posts: 610
Location: Deep below The Map of Mars
Reply with quote
Post Re: How do you make something travel along a projected arc?
Not complicated math, but I barely remember what I did it was so long ago (more than seven months). It was probably early calculus or late trig, but there's nothing very complicated.

Link: http://forums.datarealms.com/download/file.php?id=33196
It's actually a lot more than the mortar, sorry about that. I'll strip down the mod later, it has been waiting for me to get around to spriting it.
The relevant weapon is the "auto mortar," and the campaign "testing grounds" (up north on the map) has a turret that uses it.
The scripts where I do the targeting for the gun or the turret (actually just its gun too) are in Smart Mortar.rte/Scripts/Script Aim.lua (and "Script Turret Aim.lua which actually may be more recent).


It does not currently have stuff to plot the arc, but the math to do that is also not hard. You simply chose a number of distances along the arc and plug that in to get their positions (and then spawn glows there or something).


Last edited by PhantomAGN on Wed May 26, 2010 1:56 am, edited 1 time in total.



Wed May 26, 2010 1:53 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: How do you make something travel along a projected arc?
GlobalAcceleration (the vector quantity stored in Scene data) cannot be modified through Lua; once a scene is loaded, all the relevant information is held in RAM and cannot be flushed or edited by Lua.


Wed May 26, 2010 1:56 am
Profile
User avatar

Joined: Mon Jun 29, 2009 2:40 am
Posts: 610
Location: Deep below The Map of Mars
Reply with quote
Post Re: How do you make something travel along a projected arc?
Thanks for the heads-up Grif. That's too bad, though kinda unneeded. You can just as easily chose to not let gravity have an effect and simulate it in Lua. Anyway, you don't need to modify that for that mod you want to do, just accelerating the actor should be enough (as well as a landing detection and blast).


Wed May 26, 2010 1:59 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.087s | 15 Queries | GZIP : Off ]