View unanswered posts | View active topics It is currently Fri Dec 27, 2024 9:10 am



Reply to topic  [ 18 posts ]  Go to page Previous  1, 2
 Vertical/Horizantel Scaling? 
Author Message
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Vertical/Horizantel Scaling?
I see. Uh, how would I go about making a rope from several MOSRotatings and keeping them aligned?


Wed Dec 09, 2009 2:59 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Vertical/Horizantel Scaling?
place them along a distance with
Code:
local length = <length of MOSR in px here>      --just setting up some vars to prevent
local v = SceneMan:ShortestDistance(self.pos,pos2,true)   --horribly messy code later
local number = math.ceil(v.Magnitude / length)         --amount of mosrs needed.
for i = 1, number, 1 do --for 1 to however many MOSRs we need, do
   local particle = MovableMan:CreateMOSRotating(<MOSR PRESET HERE>, <YOUR RTE HERE>) --sorry if the syntax is wrong
   particle.Pos = self.pos v * (i / number)    -- position it a fraction along the line
   particle.RotAngle = v.AbsRadAngle       --make it rotated to the correct angle
   MovableMan:AddParticle(particle)       --add the particle
end
assuming you're adding them from an object at the origin from the rope and that pos2 is the end of the rope. sorry if the maths is wrong, its nighttime.


Thu Dec 10, 2009 11:45 am
Profile WWW
User avatar

Joined: Sun May 11, 2008 12:50 pm
Posts: 899
Reply with quote
Post Re: Vertical/Horizantel Scaling?
You could also use this:
Code:
function DrawGrappleLine(StartPosition, EndPosition, DrawLengthMultiplier, DrawingQuality, Thing2DrawWith)  -- Thanks to sunrise for the base code
   local VectorToDestination = SceneMan:ShortestDistance(StartPosition,EndPosition,SceneMan.SceneWrapsX) * DrawLengthMultiplier;
   local ParticleCount = VectorToDestination.Magnitude * DrawingQuality;
   local DistanceMultiplier = (1 / DrawingQuality);
   local DirToDestination = GetAngle(StartPosition.X, StartPosition.Y, EndPosition.X, EndPosition.Y);
   for ParticleNumber = 0, ParticleCount, 1 do
      local Particle = CreateMOSRotating(Thing2DrawWith);
      Particle.Pos = StartPosition + VectorToDestination.Normalized * DistanceMultiplier * ParticleNumber;
      Particle.RotAngle = math.rad(-DirToDestination);
      MovableMan:AddParticle(Particle);
   end
end

Just remember to change the function name. It also ♥♥♥♥ up on the map seam.


Fri Dec 11, 2009 11:22 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 18 posts ]  Go to page Previous  1, 2

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.089s | 13 Queries | GZIP : Off ]