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


Featured Threads
  inspiration alert!!!
(37 replies)
  Indespensible MaxScripts, Plugins and 3rd Party Tools
(37 replies)
  The allmighty FREE Resources Thread !
(17 replies)
  spam alert!!!
(4886 replies)
  Maxforums member photo gallery index
(114 replies)
  Maxforums Member Tutorials
(89 replies)
  three cheers to maxforums...
(240 replies)
  101 Things you didnt know in Max...
(198 replies)
  A Face tutorial from MDB101 :D
(95 replies)
  Maxforums.org Members Gallery
(516 replies)
  SON OF POST YOURSELF
(637 replies)
  Dub's Maxscript Tutorial Index
(119 replies)

Maxunderground news unavailable

 
First page  Go to the previous page   [01]  [02]  Go to the next page  Last page
 
cool script
show user profile  hamid javan
A grate but cool script!

Hi there, recently I read the conversion between s_purs and Grap.
Grap's script was a simple but very useful script and I came to the idea to create a more advanced script based on what Grap had written.
In this script you define a Terrain (no matter the name). This Terrain must be a Mesh and not Poly or...
On top of the Terrain you have the object that want to walk on the terrain. I named it StrayObj
In the Top View turn on the Auto Key and move your StrayObj (make your animation). Just in X and Y position. Don't be worry about the bumps on the terrain, that is what this script should do. Define only the rough path of your animation.
Note that the StrayObj must be in your entire animation above the Terrain because later we want to use the Ray intersect function.
After that run this script. I named it: Walk on Terrain.
A rollout appears.
Define the begin and the end frame of your animation.
Pick your strayObj and your terrain
If you want that StrayObj has the appropriate rotation check the Calculate dir.
If you are satisfied press Calculation
If done close it, but if you want to have some change no mater simply press reset, change your begin and start frame if you want and press calculation again.
I hope that the script is useful for all to you and simple to use.
This is as a gift to Grap, for the help he had done for s_purs.
If anybody has any idea to improve this script, I would appreciate for it.
Simply copy the script and, USE IT.
The script is as follow:
-------------------------------------------------------------------------------
--
-- File: WalkOnTerrain.ms
-- Last Modified 01/25/2012
-- Description: This script let your Stray Object walk on the plain
-- By: Hamid Javan
-------------------------------------------------------------------------------
-- VERY IMPORTANT: YOUR TERRAIN MUST BE A MESH AND NOT POLYGON
-------------------------------------------------------------------------------
rollout WalkOnTerrain "" width:113 height:206
(
-- VARIABLES.
local FrameBuffer=# () -- Our Original Buffer for positions
local TerrainObj -- Declare your Terrain Object
local StrayObj -- Declare your Stray Object
local animstart -- the begin frame.
local animend -- end of your animation
local DirActive = 0 --if active the stray object will has the normal of the face in each frame.
local ObjectClone
---------------------------------------------------------------------------
pickButton PickObjButt "Pick your Object" pos:[10,72] width:95 height:24
label lbl1 "walk on Terrain" pos:[18,4] width:80 height:20
editText E_FromText "" pos:[3,43] width:43 height:17
editText E_ToText "" pos:[61,43] width:43 height:17
checkbox chkDir "Calculate dir" pos:[10,126] width:95 height:20
label lbl2 "From" pos:[9,23] width:29 height:20
label lbl3 "To" pos:[68,23] width:36 height:20
pickButton PickTerrButt "Pick your Terrain" pos:[12,100] width:95 height:24
button CalButt "Calculation" pos:[10,145] width:95 height:24
button RessetButt "Reset" pos:[10,174] width:95 height:24
on WalkOnTerrain close do
(
delete ObjectClone
FrameBuffer=# ()
)
on PickObjButt picked obj do
(
StrayObj=obj
ObjectClone=copy StrayObj
hide ObjectClone
)
on E_FromText entered text do
(
animstart=(text as float)
)
on E_ToText entered text do
(
animend=(text as float)
)
on chkDir changed state do
(
if state == on then
DirActive = 1
else
DirActive = 0
)
on PickTerrButt picked obj do
(
TerrainObj=obj
)
on CalButt pressed do
(
with animate off
(
for t =animstart to animend do
(
at time t FrameBuffer[(t+1.0)] = StrayObj.pos
)
)
with animate on
(
for t= animstart to animend do
(
StrayObj.pivot =StrayObj.center
StrayObj.pivot.z = StrayObj.min.z
at time t r = intersectRay TerrainObj (ray FrameBuffer[(t+1.0)] [0,0,-1])
at time t StrayObj.pos = r.pos
if DirActive == 1 then
(
at time t StrayObj.dir = r.dir
)
)

)

)
on RessetButt pressed do
(
with animate off
(
delete StrayObj
unhide ObjectClone
StrayObj = ObjectClone
ObjectClone=copy StrayObj
hide ObjectClone
)
FrameBuffer=# ()
)
)
---------------------------------------------------------------------------
-- end rollout.
-- Create dialog.
createDialog WalkOnTerrain width:113 height:206\
style:#(#style_sysmenu,#style_titlebar)
---------------------------------------------------------------------------
-- end script.

read 564 times
1/30/2012 8:28:57 AM (last edit: 1/30/2012 8:28:57 AM)
show user profile  Nik Clark
Grap is my personal hero. I'll give the script a look this morning.



read 558 times
1/30/2012 9:39:36 AM (last edit: 1/30/2012 9:39:36 AM)
show user profile  Dave
I've always said that Grap is the smart one, not that faker who calls himself Garp.

"I flew over Egypt once"

read 534 times
1/30/2012 11:03:07 AM (last edit: 1/30/2012 11:03:07 AM)
show user profile  Nik Clark
Grap>Garp.

I just tried the script. It seems to work fine. It would be nice if you could make the object follow the angle of the terrain without adding strange rotations to it.





read 532 times
1/30/2012 11:04:35 AM (last edit: 1/30/2012 11:04:35 AM)
show user profile  Mr_Stabby
Yeah if nobody knows the answer Grap usually does

read 524 times
1/30/2012 11:23:21 AM (last edit: 1/30/2012 11:23:21 AM)
show user profile  BishBashRoss
Grap Grap!





read 522 times
1/30/2012 11:38:33 AM (last edit: 1/30/2012 11:38:33 AM)
show user profile  Grap
Aw guys that's so sweet..




read 507 times
1/30/2012 12:59:10 PM (last edit: 1/30/2012 12:59:10 PM)
show user profile  Nik Clark
Applauds Grap for dedication and commitment.





read 502 times
1/30/2012 1:15:54 PM (last edit: 1/30/2012 1:15:54 PM)
show user profile  Dave
Yeah, you don't see that sort of effort from Garp, that's for sure. Huzzah for Grap!

"I flew over Egypt once"

read 498 times
1/30/2012 1:19:26 PM (last edit: 1/30/2012 1:19:26 PM)
show user profile  Garp
wtf?




read 493 times
1/30/2012 1:24:51 PM (last edit: 1/30/2012 1:24:51 PM)
show user profile  Nik Clark
Garp, you're old news. It's Grap all the way, baby!



read 491 times
1/30/2012 1:26:08 PM (last edit: 1/30/2012 1:26:08 PM)
show user profile  Grap
Garp, I'm your doppelgänger!




read 486 times
1/30/2012 1:29:53 PM (last edit: 1/30/2012 1:30:07 PM)
show user profile  herfst1
What? There's a Grap AND a Garp? Confusing times for dyslexics like me.
read 474 times
1/30/2012 1:42:33 PM (last edit: 1/30/2012 1:42:33 PM)
show user profile  Garp
Now I can haz schizophrenia!

When I was walking up the stair..




read 467 times
1/30/2012 1:50:39 PM (last edit: 1/30/2012 1:51:31 PM)
show user profile  9krausec
^LOL at all of the above...




- Portfolio-




read 445 times
1/30/2012 4:28:55 PM (last edit: 1/30/2012 4:28:55 PM)
 
First page  Go to the previous page   [01]  [02]  Go to the next page  Last page
 
#Maxforums IRC
Open chat window


Support Maxforums.org