Ask a Question related to Macromedia Director 3D, Design and Development.
-
Wriker #1
Getting worldPosition of group of models
Hi,
I have troubles getting the position of a group of models. The group
consists of a bunch of box models created with Lingo. Director documentation
says I can use worldPosition with a group, but all it returns is
vector(0,0,0). If I target a single model directly, it does return the correct
vector.
Is it not possible to get the worldPosition of a group of models, or am I
missing something?
Wriker Guest
-
"group by" - order of rows in group
this is simple example: TABLE SCHEMA: create table my_table( id int unsigned not null auto_increment primary key, project varchar(255) not... -
3D models
just a quick question, what do you guys think is the best software to use when designing 3D models for use in director or flash? -
May 29 Sydney Developers Group study group
On Monday 29th May, we'll be studying Actionscript 3. Please read the articles prior to the meeting (see <a target=_blank... -
Offsetting a model's worldPosition in modelsUnderRay
Im using the modelsUnderRay to project a beam from my moving model to detect collisions. Its working just fine, but what I would like is to be able... -
cfgrid inside a <cfoutput query="myQuery" group="GROUP">
Is it possible to use a cfgrid inside a cfoutput with a query and a group. When I try do that I get the following error: INVALID_CHARACTER_ERR:... -
hondo3000 #2
Re: Getting worldPosition of group of models
the group is not automatically the average worldposition of all models you put in. you have to calculate the position of the group by hand before you put the models in.
regards!
hondo3000 Guest
-
Wriker #3
Re: Getting worldPosition of group of models
I was afraid of that, I guess I'm still thinking too much "in sprites".
I think I'll best just get the worldPosition of one of the models in the group and do some math from there.
Wriker Guest
-
a?ex #4
Re: Getting worldPosition of group of models
you can group sprites ?
:-)
in fact the it is the naming, that may confuse.
a group is a node, just like a model, a camera and a light. a node has a
transform and a parent and an array of children.
there are some other common properties of nodes like for example all of them
have a property userdata.
a group is just the minimum node type with no further "features". a model can
have a modelresource as a feature and several properties, which determine how
the modelresource gets rendered.
that's it more or less.
you could completely ignore groups and use models with void modelresources
instead of groups. they act and behave exactly the same.
but in no case it would make sense, if the transform of the group changed,
depending on the transforms of its children.
what you would want means, you move a child in the group and the position of
the group in the world would magically change?
You wouldn't have much fun with that, for sure.
a?ex Guest
-
Wriker #5
Re: Getting worldPosition of group of models
What I was trying do to, by the way, is rotate the group of models around an
axis that is on the outside of the group -- i.e. like opening a door. To open a
door that opens to the left, I need an axis that is on the leftmost position of
the door. If it opens to the right, the axis is on the right side.
When working with sprites, you can easily get the leftpos or the rightpos of a
sprite, but that's not so easy in 3-D. ;-)
Wriker Guest
-
Roofy #6
Re: Getting worldPosition of group of models
[q]Originally posted by: Wriker
What I was trying do to, by the way, is rotate the group of models around an
axis that is on the outside of the group -- i.e. like opening a door. To open a
door that opens to the left, I need an axis that is on the leftmost position of
the door. If it opens to the right, the axis is on the right side.
When working with sprites, you can easily get the leftpos or the rightpos of a
sprite, but that's not so easy in 3-D. ;-)[/q]
Acutally there is a simple way of doing this in 3d. There are 2 things you can
do.
1. if you know where this outside of the group axis is located, then do this...
yourGroup.rotate(yourOutsideAxisPosition, whichAxisYouWantToRotateAbout,
yourAngle)
2. if you do not know the outside position, then do this...
2a. before you do anything, and if you do not have 3DPI, I would recommend
downloading it at [url]http://www.3dpi-director.com/[/url]. In there you will find the
link to download and also a link for the tutorials. Otherwise continue to the
next step.
2b. create a new box in 3DPI, and then play with its position so that the new
box is located to the position of where you want this some known outside
position to be and note down the position where you have placed you new box.
Note... this does not accually create the new box for you. You will need to put
the below script that I give you to acually create the box.
2c. in your behaviour script that controls the rotation, place this following
line of code at the very top of the behaviour script before any of the handlers
that get called...
property pModel
2d. before accessing the rotation in your behaviour script, setup the
following script inside your on beginSprite handler
--create a new modelresource and make the visabillty not to be viewable by
setting the last argument to #none
mr = member("your3DMember").newModelResource("NameOfMod elResource", #box,
#none)
mdl = member("your3DMember").newModel("NameOfNewModel", mr)
mdl.trasnsform.position = the position that you have noted from 3DPI
pModel = mdl
2e. By doing the above script, you have created an invisable box that can be
used as an axis like a door hinge. You would use its position in replace of the
position of what is your outside of the group position like so...
yourGroup.rotate(pModel.transform.position, yourAxisYouWantToRotateAbout,
yourAngle)
also note that the "yourAxisYouWantToRotateAbout" is a vector that says you
either want the object to rotate along the x axis which would be set to
vector(1, 0, 0), or along the yAxis which is set to vector(0, 1, 0), or along
the z axis which is set to vector(0, 0, 1), or a combintation like so...
example vector(1, 1, 0) will rotate an object along both the x and y axises.
HTH,
roofy
Roofy Guest



Reply With Quote

