logo   login
right
Home Forums Downloads Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Forum Info
Forum Members: 18,644
Total Threads: 8,746
Posts: 95,530

Administrators:
DeeZire, Redemption

There are currently 23 users online.
Partner Links

Free Credit Repair

Learn the Ticket Broker Secrets
Advertisements


Generals & Zero Hour Editing Discuss any modding related issues to do with Generals and Zero Hour here.

Reply
 
LinkBack Thread Tools
Old 06-02-2004, 01:53 AM   #1 (permalink)
Senior Member
 
Join Date: Feb 2004
Location: China
Posts: 356
Default basical arithmetic questions in gmax/3dmax

the 1st question:

$A.pos = [1,2,3]
$C.pos = [4,5,6]
--the distance between a and c is 5.19615
--B is a child of A.
in coordsys world $B.pos = [1,2,8.19615]
--or
in coordsys parent $B.pos = [0,0,5.19615]

how to make the poses of B and C coincidednt by rotating A?
how to calculate accurately the amount of A.rotation?

the 2nd question:

when I set the pos and the rotation of an object by maxscript there will be different results if I change the sequence of setting pos and rotation.

for example, there are 2 boxes called A and B.


if the pos is set first, B.pos will be changed when B.rotation is set.
Code:
$B.pos = $A.pos
$B.rotation = $A.rotation
else B.pos will coincide with C.pos.
Code:
$B.rotation = $A.rotation
$B.pos = $A.pos
Why this happend? and How to get the right result while the pos is set first.
coolfile is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-02-2004, 06:46 AM   #2 (permalink)
Senior Member
 
Join Date: May 2004
Posts: 281
Send a message via MSN to Straxovich
Default

does anyone understand this?

and what does this have to do with generals?
Straxovich is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-02-2004, 07:40 AM   #3 (permalink)
Senior Member
 
Join Date: Sep 2001
Posts: 734
Send a message via ICQ to Flyby
Default

amazingly, yes, i understand what Coolfile is asking.

The problem is that I haven't done any scripting for almost 1.5 years and my knowledge is getting very rusty.

Coolfile, may I suggest posting that question on either the GMAX forum or on the 3dsmax support forum. There are a few VERY talented people out there that are kind enough to help other fellow scripters...

GMAX forum
http://www.gmaxsupport.com/forum/cgi-bin/ultimatebb.cgi

3dsmax forum (best forum)
http://support.discreet.com/webboard/wbpx.dll/~3dsmax
Flyby is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-02-2004, 07:42 AM   #4 (permalink)
Senior Member
 
Join Date: Mar 2003
Location: Nijmegen, The Netherlands
Posts: 849
Default

No its wierd shit i dont know what he wants :s maybe he cloned box B and rotate the box and box A go's gotating to. if thats so he must dislink the boxes
Chrizz is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-02-2004, 07:52 AM   #5 (permalink)
Senior Member
 
Join Date: Jan 2003
Location: uk
Posts: 186
Send a message via MSN to TylerD
Default

Its maxscript... I kinda understand the first few lines but then it goes right over my head... :/

edit: looks like everyone beat me to it :scared:
TylerD is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-02-2004, 08:11 AM   #6 (permalink)
Senior Member
 
Join Date: Feb 2004
Location: China
Posts: 356
Default

Thank you, Flyby. I am going to those forums now.
BTW, please check you PM. and Rene too.
coolfile is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-02-2004, 11:51 AM   #7 (permalink)
Senior Member
 
Join Date: Jul 2003
Location: The Netherlands
Posts: 141
Send a message via ICQ to Rene
Default

This should fix the positioning before rotation problem you have:

Code:
$B.pos = $A.pos
in coordsys local($B.rotation = in coordsys world($A.rotation))
Rene is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-02-2004, 01:55 PM   #8 (permalink)
Senior Member
 
Join Date: Jul 2003
Location: The Netherlands
Posts: 141
Send a message via ICQ to Rene
Default

Your second question took me some time to get right, mostly because of a different result between my calculator and gmax. I don't know if your familiar with matrix and vector calculations however I will use some terms that may not ring a bell. gmax has internal functions for all of these.

To map your point B onto point C using rotations you'll first need the vectors from the rotation origin (point A in this case). You can either calculate them manually or be a bit creative with the coordsys like I did. Now normally I would advise you to normalize these vectors but maxscript gives weird results when calculating with the normalized values. So we'll first calculate and then normalize.

You'll need the cross product between the vectors. This results in an rotation axis. Normalize the result.

Now you need the dot product and devide it by the product of the lenghts of the vectors (same result as calculating with normalized vectors). This gives the cosinus of the angle between the two vectors. Inverse it to get the actual angle.

All that's left now is to rotate the origin (point A) in it's local coordsys.


In maxscript this would make:

Code:
vAB = in coordsys $A.transform $B.pos
vAC = in coordsys $A.transform $C.pos

axis = normalize(cross vAB vAC)
angle = acos ((dot vAB vAC) / ((length vAB) * (length vAC)))

in coordsys local $A.rotation = (angleAxis angle axis)
Rene is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-02-2004, 10:16 PM   #9 (permalink)
Senior Member
 
Join Date: Feb 2004
Location: China
Posts: 356
Default

What a genius you are, Rene! Thank you very much.
BTW, have you read you PM? and would you like to try my new w3d importer? If yes, please give me your email via PM.
coolfile is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-02-2004, 10:31 PM   #10 (permalink)
Senior Member
 
Join Date: Jul 2003
Location: USA
Posts: 442
Send a message via MSN to EvilViking
Default

So you're scripting a new W3D importer? Sweet! Hats off to you guys, this is way over my head! :lol:
EvilViking is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
gmax to 3dmax or 3dmax to gmax freedom__fighter Generals & Zero Hour Editing 8 11-28-2004 03:36 PM
Texturing in 3Dmax - Match viewport colour to in-game colour key0p Generals & Zero Hour Editing 8 10-02-2004 06:32 PM
skining in 3dmax Hostile Generals & Zero Hour Editing 6 06-17-2004 07:07 AM
Gmax Lastthingusee Other C&C Editing 3 11-05-2003 12:00 PM
Gmax Questions.... Carbon Generals & Zero Hour Editing 2 04-28-2003 05:51 PM


All times are GMT -4. The time now is 10:17 PM.


Design By: Miner Skinz.com
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.