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

Members Online

»
0 Active | 45 Guests
Online:

LATEST FORUM THREADS

»
Gaming
Q4 General
eXtreme+ v2.9
CoDBO Map + Mod Releases
map loading error
CoD2 MP Mapping
Good Servers on PC
CoDBO General

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 4
Category: CoD4 MP Mapping
CoD 4 mapping and level design for multiplayer.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: moving model in circle
BUSH1DO
General Member
Since: Apr 2, 2014
Posts: 40
Last: Sep 9, 2016
[view latest posts]
Level 2
Category: CoD4 MP Mapping
Posted: Monday, Jun. 1, 2015 01:09 pm
HI ! who knows how to make model to rotate in circe, not around its own centre? Lets say i have a shark model which i want to move in circe.
Share |
DeekCiti
General Member
Since: Mar 12, 2008
Posts: 1293
Last: Jul 8, 2016
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Monday, Jun. 1, 2015 01:24 pm
Technically, it would be around its own center, only you define where that center is.

If it rotates in a circle then it must have a center point of rotation. Just like a ball on the end of a rope. If the rope was a stick and the ball was the shark, then the point of rotation (the origin) would be you swinging the rope and ball.

If you need the stick, just make the stick/rope invisible to the player, and if need be, make it non colliding. Create an origin of rotation from there. The origin, stick and the shark are all one script brushmodel. It would be no different than rotating a fan, only on a larger scale and a slower speed. Even if you use a model, just add it as a script model.

You really don't need the stick, you just need the origin and the script brushmodel/model.
Share |
BUSH1DO
General Member
Since: Apr 2, 2014
Posts: 40
Last: Sep 9, 2016
[view latest posts]
Level 2
Category: CoD4 MP Mapping
Posted: Tuesday, Jun. 2, 2015 07:31 am
i know how to make brush rotate in radius, but with model its more complicate coz you cannot make model like script brushmodel (only script model), ive tried with origin texture make it brushmodel and conected with model via W, i think need to add line in rotate script about model with target-rotate, for origin targetname- rotate. ive tried already different combitations - no result.
here is script
Code:
main()
{
  rotate_obj = getentarray("rotate","targetname");
  if(isdefined(rotate_obj))
  {
   for(i=0;i<rotate_obj.size;i++)
   {
    rotate_obj[i] thread ra_rotate();
   }
  }
}
 
ra_rotate()
{
  if (!isdefined(self.speed))
   self.speed = 10;
  if (!isdefined(self.script_noteworthy))
   self.script_noteworthy = "z";
 
  while(true)
  {
  // rotateYaw(float rot, float time, <float acceleration_time>, <float deceleration_time>);
   if (self.script_noteworthy == "z")
    self rotateYaw(360,self.speed);
   else if (self.script_noteworthy == "x")
    self rotateRoll(360,self.speed);
   else if (self.script_noteworthy == "y")
    self rotatePitch(360,self.speed);
    wait ((self.speed)-0.1); // removes the slight hesitation that waittill("rotatedone"); gives.
  // self waittill("rotatedone");
  }
}


edited on Jun. 3, 2015 01:59 am by Mystic - added code box
Share |
DeekCiti
General Member
Since: Mar 12, 2008
Posts: 1293
Last: Jul 8, 2016
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Wednesday, Jun. 3, 2015 11:59 pm
Have you tried linking an origin to the model? Obviously the code I have posted and commented out won't work as is, but you can probably modify it to work properly. Defining a new origin of rotation? You would have to link the shark to the origin brush, I believe both in radiant and in script.

I have done something similar in the past but it has been forever and I'm not able to test this, but maybe it can give you an idea, or at least something to go on.

Code:

main()
{
//	shark = getent("sharkModel", "targetname");
//	rotOrigin = getent(shark.target, "targetname");
//	rotOrigin enablelinkto();
//	rotOrigin linkto(shark);

//      Do all the rotation crap in script...
	
	rotate_obj = getentarray("rotate","targetname");
	
	if(isdefined(rotate_obj))
	{
		for(i=0;i<rotate_obj.size;i++)
		{
			rotate_obj[i] thread ra_rotate();
		}
	}
}
 
ra_rotate()
{
	if (!isdefined(self.speed))
	{
		self.speed = 10;
	}
	if (!isdefined(self.script_noteworthy))
	{
		self.script_noteworthy = "z";
	}
 
	while(true)
	{
		// rotateYaw(float rot, float time, <float acceleration_time>, <float deceleration_time>);
		
		if (self.script_noteworthy == "z")
		{
			self rotateYaw(360,self.speed);
		}
		else if (self.script_noteworthy == "x")
		{
			self rotateRoll(360,self.speed);
		}
		else if (self.script_noteworthy == "y")
		{
			self rotatePitch(360,self.speed);
		}
		wait ((self.speed)-0.1); // removes the slight hesitation that waittill("rotatedone"); gives.
		// self waittill("rotatedone");
	}
}


Why can't you just set a path for the shark and have it move to point A, to B and so on?

Also, using the brackets makes the code so much easier to read. I had to put them in, it was driving me nuts. [crazy]
Share |
BUSH1DO
General Member
Since: Apr 2, 2014
Posts: 40
Last: Sep 9, 2016
[view latest posts]
Level 2
Category: CoD4 MP Mapping
Posted: Thursday, Jun. 4, 2015 01:35 am
attachment: image(807.8Kb)
Thanks for help DeekCiti, but still i facing problems.
When i try to use script origin brushmodel and connect to model origin i have error in compile. When i use script origin(red box) and connect it to model origin(as on picture) nothing happend, you said its more easy to make pass. Do i need to write coordinates for pass? Can you explain me. Never make it b4.
Share |
DeekCiti
General Member
Since: Mar 12, 2008
Posts: 1293
Last: Jul 8, 2016
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Thursday, Jun. 4, 2015 12:41 pm
This probably isn't the best way for realistic purposes but since I don't know how you want it to look. You can do something like this. Basically, where the shark sits on map load is the HOME for the shark.

When the map starts, the script starts moving the shark to different points around the map, which you define in script. Using XYZ coords. You can rotate the shark so it can turn and such. Just duplicate the MoveTo and or the rotateYaw lines for the full path the shark is going to use until it finally does its complete loop, and can then loop until the map ends.

Swap out the shark targetname in script and edit the coords and a few other properties and you should be able to get it moving. You don't need any origins, or linking, just the Shark Model as a script model. I haven't tested the code, so if there are errors, they should be easy to fix.

Code:

main()
{
	thread shark();
}

shark()
{
	sharkModel = getEnt("MY SHARK MODEL", "targetname");
	
	while (1)
	{
		// Move shark to first point
		sharkModel moveTo ((-704, -800, 496),6,2,2);  // ((x,y,z), total move time in seconds, acceleration time, deceleration time))
		sharkModel waittill("movedone");
		iprintlnbold("Moved Shark to First Point"); // Debug line
	
		// If you need to rotate the shark a little before next move or during move	
		sharkModel rotateYaw (-90,3,0.5,0.5);  // (angle, total move time in seconds, acceleration time, deceleration time)
	
		// Move shark to second point
		sharkModel moveTo ((-204, -300, 523),3,1,1);  // ((x,y,z), total move time in seconds, acceleration time, deceleration time))
		sharkModel waittill("movedone");
		
		// Move it and rotate it as many times as you need to
		// Eventually get the shark back to HOME (where it started on map load) so script can loop
	}
}
Share |
BUSH1DO
General Member
Since: Apr 2, 2014
Posts: 40
Last: Sep 9, 2016
[view latest posts]
Level 2
Category: CoD4 MP Mapping
Posted: Thursday, Jun. 4, 2015 01:43 pm
[jumping]
Thanks a lot !!! Its working !!![rocking]
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 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

»