Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds
Watch MODSonair

Members Online

»
0 Active | 44 Guests
Online:

LATEST FORUM THREADS

»
Call of DutyŽ: WWII
CoD WW2 General
SOF2 Prefabs map
SoFII Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 MP Mapping
CoD 2 mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Curved trajectory
karabao32
General Member
Since: Mar 11, 2010
Posts: 24
Last: Apr 4, 2014
[view latest posts]
Level 1
Category: CoD2 MP Mapping
Posted: Monday, Oct. 22, 2012 04:42 am

Hey!

Is it possible to bend a trajectory of a brush model to a script origine,or connect 4 or 5 script origine to change the way of the object with a curved trajectory?

Thx!

Share |
tHMatt
General Member
Since: Sep 11, 2007
Posts: 473
Last: Mar 20, 2013
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Monday, Oct. 22, 2012 05:02 am
Quadratic Bezier curves between point A and B, then B to C and so on.
Share |
karabao32
General Member
Since: Mar 11, 2010
Posts: 24
Last: Apr 4, 2014
[view latest posts]
Level 1
Category: CoD2 MP Mapping
Posted: Monday, Oct. 22, 2012 05:09 am
Hi and thanks, but what is "Quadratic Beziert"?[confused]...
Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Monday, Oct. 22, 2012 10:24 am
create an array with:
the first entry as your starting point
the last entry as your target point
the entries between as your curve point (act like 'hinges' to create the curve)

call a loop to move your object to to your target end let the code recalculate your next target to call moveTo() on

Code:

/*=============
Name: curve( <posArray> , <fraction> )
Summary: Returns a smooth curve between the first and the last point in the posArray, directed by the points in between them.
CallOn: none
required Arg: <posArray>: An array including the starting point as first value, the endpoint as last value and directing points between start and endpoint.
required Arg: <fraction>: The fraction between 0 and 1.
Example: point = curve( pointArray , 0.75 );
=============*/

curve( p , f )
{
	// y(t) = sum( binom( n , i ) * p[i] * ( t^i * ( ( 1 - t )^( n - i ) ) ) )

	n = p.size - 1;
	vec = ( 0 , 0 , 0 );

	for( i = 0 ; i < p.size ; i++ )
	{
		vec += vectorScale( p[i] , binom( n , i ) * power( f , i ) * power( ( 1 - f ) , ( n - i ) ) );
	}

	return vec;
}

power( value , power )
{
	result = 1;

	for( i = 0 ; i < power ; i++ )
	{
		result = result * value;
	}

	return result;
}

binom( n , k )
{
	binom = 1;

	if( n <  0 || n > 100 || k < 0 || k > n ) 
		return -1;

	if( k == 0 || k == n ) 
		return 1;

	for( i = 1 ; i <= k ; i++ )
	{
		binom *= ( ( n - i + 1 ) / i );
	}

	return binom;
}

vectorScale( v , s )
{
	return ( v[0] * s , v[1] * s , v[2] * s );
}


credits goes to extreme, i just rewrote their parts
Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Monday, Oct. 22, 2012 11:26 am
to explain it a bit more:
this function interpolates between an array of points an gives you the coordinates to a specific fraction of your curve: (sorry it was fast-paintned :D)
Share |
karabao32
General Member
Since: Mar 11, 2010
Posts: 24
Last: Apr 4, 2014
[view latest posts]
Level 1
Category: CoD2 MP Mapping
Posted: Monday, Oct. 22, 2012 11:44 am
Yes, great with fast paintned ;D.

I'll try this...

Thx.
Share |
karabao32
General Member
Since: Mar 11, 2010
Posts: 24
Last: Apr 4, 2014
[view latest posts]
Level 1
Category: CoD2 MP Mapping
Posted: Monday, Oct. 22, 2012 11:45 pm
[confused][crazy] Heuum I'm maybe a noob but where I had to put this script? in may plane.gsc or another one?

This is my plane.gsc:

Code:


main()
 {
 level thread planes();

 }
 planes() 

{
 level.PlaneSpeed = 3.5; 

stuka1 = getent ("stuka1","targetname"); 

temp = getent (stuka1.target,"targetname"); stuka1.dest = temp.origin; 
stuka1.start = stuka1.origin; 
stuka1 hide(); 

wait 2;

 while (1) 

{
 stuka1 thread plane_flyby("stuka_flyby");

wait 60;
 }
 }
 plane_flyby(sound) { // If you specified a sound to play then play it 
if (isdefined (sound)) 
self playsound (sound); 

wait 15; 

self show(); 

self moveto(self.dest, level.PlaneSpeed, 0.1, 0.1); 

wait level.PlaneSpeed; 

self hide(); 
self.origin = self.start; }

Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Tuesday, Oct. 23, 2012 02:17 am
Mate, can you draw me small picture to show me how you want your plane to move? I guess this wouldn't require this complex maths then..
Share |
karabao32
General Member
Since: Mar 11, 2010
Posts: 24
Last: Apr 4, 2014
[view latest posts]
Level 1
Category: CoD2 MP Mapping
Posted: Tuesday, Oct. 23, 2012 02:31 am
Yea thanks m8!

Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Tuesday, Oct. 23, 2012 04:12 am
pseudo code (the way I would make this..):
Code:
time = 5.0;

plane moveTo( pointA , time ); //plane moves to the starting point of your curve

wait( time - 0.1 ); //wait a bit shorter to prevent a small delay of the movement

plane moveCirclular( 1024 , 180 , 3.0 , "left" ); //move on a bent line

plane moveTo( endPoint , time ); //move to the endpoint

wait( time - 0.1 );
//finish
plane delete();


moveCirclular():
Code:
moveCirclular( radius , degrees , time , direction )
{
	center = self.origin;
	right = anglesToRight( self.angles );
	right = ( right[0] * radius , right[1] * radius , right[2] * radius );

	if( !isDefined( direction ) || direction == "right" )
		center += right;
	else
		center -= right;

	linker = spawn( "script_model" , center );

	self linkTo( linker );

	linker rotateYaw( degrees , time );

	wait( time - 0.1 );

	self unlink();

	linker delete();
}


hope this will work
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 MP Mapping

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»