Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography


Featured Threads
  Speedmodeling 2011 - Holidays Edition
(117 replies)
  Maxforums Kiva Group
(57 replies)
  The Life of a Sea Turtle - Tutorial by mrgrotey
(121 replies)
  So what are you working on? =)
(2627 replies)
  Want free webspace?
(20 replies)
  spam alert!!!
(3920 replies)
  Maxforums member photo gallery index
(113 replies)
  Maxforums Member Tutorials
(86 replies)
  three cheers to maxforums...
(185 replies)
  The Grotorial Index Page
(57 replies)
  101 Things you didnt know in Max...
(185 replies)
  A Face tutorial from MDB101 :D
(95 replies)
  Free textures thread
(77 replies)
  Maxforums.org Members Gallery
(486 replies)
  SON OF POST YOURSELF
(626 replies)
  Dub's Maxscript Tutorial Index
(119 replies)
  The Best Art of Maxforums [56k warning]
(109 replies)


 
First page  Go to the previous page   [01]  [02]  Go to the next page  Last page
 
arrow with a variable size depending on position and velocity of an object
show user profile  dinant
In a scene, I want to draw an arrow fixed to a movable object for which its size and direction depend on the velocity and speed of that object. I guess that that would be possible using MAXscript, but I have no experience with that. My programming skills are restricted to MATLAB.
read 579 times
3/10/2010 5:46:48 PM (last edit: 3/10/2010 5:46:48 PM)
show user profile  Hua*MuLan~
Maybe you need script controller to make this constraint.
Every day is a new day

MSN:qq343294964@hotmail.com

read 539 times
3/11/2010 7:50:43 AM (last edit: 3/11/2010 7:50:43 AM)
show user profile  dinant
thanks for your reply. I was already guessing that I would need MAXscript, but I have no experience and the helpfiles/tutorials doesn't seem to have related topics.
read 521 times
3/11/2010 4:42:56 PM (last edit: 3/11/2010 4:42:56 PM)
show user profile  dinant
Come on, nobody that can help me?
read 490 times
3/12/2010 6:31:33 PM (last edit: 3/12/2010 6:31:33 PM)
show user profile  dinant
So, no options?
read 377 times
3/30/2010 9:25:11 PM (last edit: 3/30/2010 9:30:57 PM)
show user profile  dinant
if only the famous MrGrotey was here...
read 312 times
4/13/2010 6:21:25 PM (last edit: 4/13/2010 6:21:38 PM)
show user profile  9krausec
I would most definatly play around with wiring constraints a bit. I don't have a definate answer, but I think you may be able to work something out with postion (not really velocity)...

Example... A ball with a arrow with a few bones in it. The first bone is fixed (realitve to the ball and is closest to the ball), the second bone could have a squash like controller on it (there is a bone tool were this can be toggled on and off... Then the end of the second bone could be linked to a dummy... Wiring the controller you could say as position on X axis increases, the dummy will go so far in the same direction just at a pinch less of a speed so it would be trailing behind a little (making the arrow get longer)...

I have no clue if that just made any sense, but it did in my mind. Good luck!
read 306 times
4/13/2010 6:31:58 PM (last edit: 4/13/2010 6:31:58 PM)
show user profile  mrgrotey
Im always here.

I just dont know what the solution is ;)



read 296 times
4/13/2010 7:27:39 PM (last edit: 4/13/2010 7:27:39 PM)
show user profile  9krausec
@ MR.G- Did my kind of sort of solution seem to make sense? Could this be done with wiring constrants? Go Mr.G Go!
read 290 times
4/13/2010 7:36:11 PM (last edit: 4/13/2010 7:36:11 PM)
show user profile  dinant
Well, if MrGrotey doesn't know... But thanks for replying.

@ 9krausec:
I'm kinda understanding it a bit. The thing is though that I need to make an arrow with the exact location:
Arrow_x=0;
Arrow_y=(25*xdot-25*ydot)*(.2-y);
Arrow_z=0;

xdot and ydot refer to the x and y velocity of a object and y is the position of that object.

read 280 times
4/13/2010 10:29:40 PM (last edit: 4/13/2010 10:29:40 PM)
show user profile  9krausec
Thats just it. As far as I know wiring constrants deal with direct correlations-

postion of x=postion of y(1/2*posY) (example, it wont work period, but somewhat of a representation of a direct correlation).

The real trick here is trying to get a variable that changes with the velocity of an object... The only way you would be able to do this without code (that I know of anyways) would be to fake it with simple animation...

Best of luck, sorry I couldn't be more help (I do know however that there are a few people on this forum that are MaxScripting gods, so perhaps they may step in).
read 268 times
4/14/2010 12:09:38 AM (last edit: 4/14/2010 12:09:38 AM)
show user profile  Stephen R.
I dont do maxscript, but scripting is fairly universal, couldnt you do something like this for each frame?


objectPos_new (Holds the most recent position)
objectPos (Holds the previous position)
checkPos = myObject.y + myObject. + myObject.z; (checks the current position)

if checkPos > objectPos_new { (check to see if the new position is greater than the last
objectPos = objectPos_new known position, and if it is, update the values accordingly)
objectPos_new = objectPos;
};

ArrowScale = objectPos_new - objectPos; (find the difference between the two positions)
Arrow.scaleX = ArrowScale; (Set the scaling to the arrow scale, may need to be divided to
Arrow.scaleY = ArrowScale; act properly)
Arrow.scaleZ = ArrowScale;





Vibrant9 Logo


read 262 times
4/14/2010 12:20:52 AM (last edit: 4/14/2010 12:24:41 AM)
show user profile  Dub.
Here is how to do it.

You need two objects - an animated object and the arrow. I used a pyramid for the arrow.


In the pyramid you need to add a transform script controller into the transform channel.


Paste the following code in:


pos = Sphere.pos
at time (F-1) (oldPos = Sphere.pos)
dir = normalize ((oldpos - pos) * -1)
up = [0,0,1]
x = cross dir up
y = cross x dir
matrix3 -x y dir pos


Create a new variable called "Sphere", click "Assign Node" and pick your animated object.


Hit close and now the pyriamid should point in the direction that the sphere is moving (of course it needs to be animated).

Next you need to add a float script to the height controller on the pyramid.
Do the same new variable thing and select the sphere (or whatever your animated object is) and paste in this code:


pos = Sphere.pos
at time (F-1) (oldPos = Sphere.pos)
length (((oldpos - pos)) * 10.0)


you can adjust the "10.0" in there - it is a multiplier for the length of the arrow. I put 10 so it gets nice and long.

Hit close and you should be done!

Here is the max file. (2010) http://www.filamentvfx.co.nz/dump/arrow.max



read 245 times
4/14/2010 3:55:11 AM (last edit: 4/14/2010 4:01:59 AM)
show user profile  Garp
Very nice, Dub!




read 233 times
4/14/2010 4:11:56 AM (last edit: 4/14/2010 4:11:56 AM)
show user profile  Stephen R.
maxscript is wierd as hell

could you explain what each step of this is doing by any chance?




Vibrant9 Logo


read 226 times
4/14/2010 5:44:37 AM (last edit: 4/14/2010 5:44:37 AM)
 
First page  Go to the previous page   [01]  [02]  Go to the next page  Last page
 
#Maxforums IRC
Open chat window


Support Maxforums.org