Away3D 4.0 TextureMaterial activateForDepth() - actionscript-3

I am new to Away3D, and I’m using version 4.1.1b.
I am having trouble with the rendering order of Meshes added to the scene.
(Objects in the distance are rendering infront of Objects closer to the Camera)
I found that in version 4.0 you could call activateForDepth() on a TextureMaterial.
It seems as though this method has been removed.
Can someone please point me towards how to fix this in 4.1.1.
I have also tried,
_view.renderer = new DepthRenderer( true, true );
This seems to fix the depth/distance problem, but everything is bright blue with circles instead of textures.
Thanks
Matt

This has now been solved, for anyone looking for the answer see this other post.
http://away3d.com/forum/viewthread/4673/

Related

[Cocos2dx - TiledMap]Get black vertical lines when move map

I make a game with cocos2d-x and tilemap follow tutorial Cocos2D-X Tile Map Tutorial
It working fine but when i move map, i get black vertical lines on screen.
http://i689.photobucket.com/albums/vv255/thansaulove/error2.png
Anyone have solution to fix it?
Many thanks in advance.
There is a way to fix this. It worked for me.
Find the ccCongig.h file and change the value of CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL to 1

Gestouch works only when mapped to stage

I am trying to use gestouch library in my project and i can't seem to get it to work properly.
This is how i am mapping it:
var tapGesture:TapGesture = new TapGesture(stage);
tapGesture.addEventListener(GestureEvent.GESTURE_RECOGNIZED, onTap);
As you can see it is mapped to the stage and this way it works...
The class where i am using it extends a flash Sprite, and i would like to map the gesture to
this, but when i do, gestouch doesn't seem to work...
I even tried putting a sprite with stage width and height on top of my view and still doesn't work...
Anyone knows what could be the problem?
Also, maybe it is important to note, i am using a ASC2.0, so i had to remove the mario mushroom operator from this part : Gestouch.inputAdapter ||= new NativeInputAdapter(stage);
I (am the author of Gestouch) haven't tested it with ASC 2.0 because it's still in development, but yea, at least it's known that there issues with "mushroom operator" and -inline compiler argument.
So the answer: stick to MXMLC or use sources and find out why it doesn't work.
Also it is better to ask questions on Github. I found this almost by accident — Google reports me of Gestouch mentions =)

Triangle edges in CanvasRenderer

I am a newbie regarding three.js and I have a problem with imported geometry (js-file from 3dsmax inclusive all material and textures) and the CanvasRenderer. The CanvasRenderer displays the triangle edges of imported geometry, the WebGLRenderer works well.
Canvas example:
http://der-n.square7.ch/threejs/examples/teapot_canvas.html
WebGL example:
http://der-n.square7.ch/threejs/examples/teapot_webgl.html
In the three.js library I have found the option "overdraw: true" for a material to fix this behaviour but obviously the material+textures are defined by the above mentioned exported 3dsmax js-file.
For the tests I use the "misc_camera_trackball" example with small changes (I have added a JSONLoader, changed some camera and trackball parameters, changed some light colors, added a CanvasRenderer)
Any hints how to solve this?
Thanks for your help.
Best regards
Oggy
In the loader callback, you have all of the loaded materials in an array geometry.materials. You could loop over those materials and set the overdraw property to true for each.
As far as I know, THREE.MeshFaceMaterial is just a pass-through material that indicates "faces have an index that points to a material instance to use from the geometry's materials array", so setting properties for MeshFaceMaterial won't have any effect.

FlashDevelop: AS3 Tweening Stop on Steep Slope

I'm using the caurina.transitions.Tweener; class with AS3 to tween a 3D object through my 3D environment (created with alternativa3D platform) from point A to point B. And everything works great, they move as intended from where they were to where I told them to go.
I was wondering if there was a way to make the object stop moving (or tweening) if the slope they were trying to walk over was too steep (like a giant hill or mountain in real life)?
This is basically the code I am using for this:
var playerDistance: Number = Vector3D.distance(
new Vector3D( _escapeeManager.activeEscapee.x,
_escapeeManager.activeEscapee.y,
_escapeeManager.activeEscapee.z ),
intersectData.point );
Tweener.addTween( _escapeeManager.activeEscapee, { x:intersectData.point.x, y:intersectData.point.y, time:(playerDistance/_escapeeManager.activeEscapee.speed), transition:"linear" } );
And if you'd like to see an example in the game I'm developing, it can be found here:
http://redmenmusic.ca/godsend.html
Thanks for your help guys!
It seems a bit odd to use Tweener for anything other than superficial animations - you probably need to implement a more complex system to handle object movement, collision detection, slopes etc.
The caurina.transitions.Tweener has some properties that could come by handy for your problem. I'am not saying it's the Tweener is the best way, bit it will get you where you want I guess :).
The official Tweener documentation website can be found here: http://hosted.zeh.com.br/tweener/docs/en-us/. The section 'Tweening parameters' would be a interesting read for you.
So for your problem, I would suggest to approach it this way:
There is a onUpdate event which is executed on every update of the Tweener. On every update you could check if the slope is to steep or not.
Example:
Tweener.addTween(myMovieClip, { x:100, time:1, onUpdate:function() { /* check here if the slode is to steep - if it is you can remove the Tweener on the object and proceed with an other function */ }});
I hope it's clear :)
Good luck!

Adding a canvas-sprite object to a canvas?

I've been playing around with HTML5 and canvas and sprites and I've managed to get myself a bit stumped. I was wonderring if there was anyone out there with just a bit more experience than me who could help me 'tune' this (and also make it work).
I've got all the code up on GitHub https://github.com/AlexChesser/jsSprite and have put a live demo up over here http://chesser.ca/jsSprite
What you can see from Test 01 and 02 is that I'm able to send the Minotaur directly to the on-page canvas, I'm able to animate the Minotaur on the canvas... but when I try to create the Minotaur and add it to another canvas - I'm getting a blank screen.
(attempting to implement https://github.com/AlexChesser/jsSprite/blob/master/03-animated_minotaur_on_canvas.php)
I know it must be something small and sill that I'm doing wrong here, but I've been staring at it for hours and I can't track down the problem.
I thought I'd try posting up here to see if there's anyone who can see it 'in one go' AND to maybe let me know if there's anything I can do better.
If you're interested in getting a little further under the hood on this stuff, the lion's share of the code for this is coming from a Blog post http://www.johnegraham2.com/web-technology/html-5-canvas-tag-sprite-animation-demo/
Anyways, maybe it's one of those things that "comes to you" once you've walked away from the problem for a little bit. Fingers crossed I can either figure it out or someone out ther ecan give me that little push in the right direction.
Thanks!
:)
I just stepped through your code.
MainContext.drawImage(m.canvas, 0, 0, m.width, m.height);
is occuring before drawFrame gets called because the image isn't ready yet.
So the mainContext.drawImage is drawing a canvas that has nothing painted on it yet.
Then the Sprite's canvas is loaded and ready to go, but its too late!
For confirmation, you can call MainContext.drawImage(m.canvas, 0, 0, m.width, m.height); in the browser console and you will see the minotaur appear.
As Simon Sarris said, you are drawing the canvas too soon. What you'll need to do is either loop until the sprite is ready, or add a callback to your sprite that is called after it draws.
You already have a function attached to the image's onload event, you should be okay to do something similar for the whole sprite.