Hey thanks ... i tried it, but i got an error and i dont know why ...
-------------------------------------------------------
myCollision = new
BitmapData(Cast.bitmap(collision));
myCollisionmap = new
CollisionMap(myCollision, 10, 10);
myCollisionmap.setColorEvent(0xFF0000,
"red", onCollision);
myCollisionmap.read(myEyes.x,
-myEyes.z);
public function onCollision()
{
trace("berührt");
}
---------------------------------------------------------
Can you check it?
Thanks = )
On 9 Jun., 17:48, Fabrice3D <[email protected]> wrote:
> the collisionmap class is nothing than a color map reader.
> that would be for instance the map seen from above.
> each kind of element having its own color.
>
> the class, at runtime, once you pass it a coordinate x,y on the map (the x,z
> of the camera in ratio), reads the colormap.
> if a color is found that you have declared, it fires an event.
>
> so the class doesn't handle the collision
> if you set say where your table is a yellow region on that map
> basically after you have set the "color" listener, it triggers on the yellow
> reading
>
> collisionmap = new CollisionMap(mycolormap, this, 1 , 1); //here 1/1 ratio on
> x and y. if your floor is say 2048x2048 and map 1024x1024, pass 2,2
> collisionmap.setColorEvent(0xFFFF00, "yellow", onYellow);
>
> private function onYellow(event:Event):void
> {
> trace("WARNING this is an valuable furniture, look out!!";
>
> }
>
> what you do with the collision reading, is up to you. Bartek, for instance,
> for its circuit game, used a similar construction
> where the color was different from the main road. --> slowDown();
>
> but when it comes to real collision handling, i would consider take a look at
> BSP generation as David suggested,
> in fact thats the reason why we've spend the time and effort to make it in
> the first place.
>
> as a side note, take care making the colormap, if you use flash lib and the
> source is not a vector info that you draw, that
> compression, might influence the colors. so no event is triggered. So either
> you apply a custom threshold to the class,
> or the easy way, test the colors at locations you know the exact color. There
> is a getter just for that reason in the class.
>
> Fabrice
>
> On Jun 9, 2010, at 4:46 PM, joebass wrote:
>
> > I'm a newbie so take my comments with a grain of salt. My
> > understanding is that loading models as opposed to constructing in
> > Away with the extrude classes or primitives will require more
> > resources. However, it may be difficult to do everything you'd like
> > within the native Away classes. If you do use a 3D modeler, get it
> > into PreFab and use the export features, adding your models within
> > your code is a breeze. So cool Fabrice.
>
> > As far as the collision map stuff with the Frustum example, it was a
> > challenge for me to adopt them too. It took some playing around with
> > the orientation of the collision map image (I added a plane and
> > applied the map image to it to get an idea of orientation. Also
> > scales of the collision image and your model are things you may have
> > to look at. Then it's just a matter of applying your geometry to the
> > image with trial and error.
>
> > On Jun 9, 9:08 am, le_unam <[email protected]> wrote:
> >> Thanks for your fast answers.
>
> >> I have PreFab installed, but i`m not really used to it, so i have to
> >> learn how it works. Of course to model all elements is a way i knew
> >> before but i thought loading models would slow down the swf. Doesnt
> >> it?
>
> >> I know frustum hotel room demo and i got some great help from it too,
> >> but all in all i think it contains too much information, that i can
> >> understand the background behind all. i tried to take the collisionmap
> >> from there but i didnt get it work = (
> >> Is there any example in the web with an collisionmap for an easy room
> >> with only one cube in the center so that everybody can understand it?
> >> all examples are so complicated i think, it has to be more easier.
>
> >> On 9 Jun., 14:52, joebass <[email protected]> wrote:
>
> >>> As far as camera and movement other than what David mentioned, I'm
> >>> working on something similar and found the Frustum Hotel Room demo to
> >>> be a great help.
>
> >>> On Jun 9, 8:38 am, David Lenaerts <[email protected]> wrote:
>
> >>>> I would use a 3D modeler to create that (well, if I could model). It's
> >>>> really not easy to do it by compositing planes etc, and would probably
> >>>> not
> >>>> result in efficient models.
> >>>> You could use Blender, for instance: it's free, but it's user interface
> >>>> is
> >>>> sent from hell. You can export it in a format compatible with Away3D (for
> >>>> instance as an obj file). If you use PreFab and model to some
> >>>> restrictions,
> >>>> you can use Prefab3D and the BSP builder to get the walk-around for free
> >>>> :)
>
> >>>> On Wed, Jun 9, 2010 at 2:20 PM, le_unam <[email protected]> wrote:
> >>>>> Hey guys i have some basic questions about creating a room and walking
> >>>>> through it. i have already created a room and i am able to walk
> >>>>> through but i dont know if i took the right way to create it. Now i
> >>>>> just want to get some general questions.
>
> >>>>> For the First person view, to walk through my room i decided to took
> >>>>> the SpringCam. Would you use SpringCam too or is there an other, maybe
> >>>>> better way? My Problem with SpringCam is that the relations of Walls,
> >>>>> floor and roof seem to be broken. if i take the measurments of my room
> >>>>> at home and project them to away3d it seems to be incorrect. my walls
> >>>>> at home are 2,20 meters so i tried to make 220px in away. my cube,
> >>>>> which i follow with springcam, i place at y = 180 because i thought, i
> >>>>> am 1,80meters. but this gets a bad result in relation to the other
> >>>>> elements. You know? what is a good way to go there? i can solve this
> >>>>> problem if i set the height down and keep the widths but that isnt
> >>>>> what i want.
>
> >>>>> Another question is how to create a room. I created my rooms
> >>>>> exclusively by taking planes for each wall or floor or roof, but some
> >>>>> guys say you should use a cube. Of yourse when i just want to create
> >>>>> an easy room with 4 walls i can take a cube but what when the room has
> >>>>> no symmetrie or for example windows? Is there a trick to handle this
> >>>>> or are planes the right way?
>
> >>>>> In dependence on this ... how to create a rounded wall or other
> >>>>> rounded selfmade elements? What can i use? I heared something about
> >>>>> SegmentExtrude, LinearExtrude or PathExtrude but i cant get detailled
> >>>>> information about this classes and how to handle them. What leads to
> >>>>> my last point.
>
> >>>>> What is the best way to get used with away3d? How can i learn away3d
> >>>>> the best way? Where should i have the information how to use
> >>>>> SegmentExtrusion for example. It seems to be more than two lines of
> >>>>> code. if someone takes the time to help me and answer me my questions
> >>>>> i would be very happy and grateful.
>
> >>>>> Sorry for my bad english.
>
> >>>>> Greetz Manu
>
> >>>> --http://www.derschmale.com-Hidequotedtext -
>
> >>>> - Show quoted text -- Hide quoted text -
>
> >> - Show quoted text -