| Author |
Message |
|
|
Frango Frangolet wrote:
petiot simon wrote:hello, I've read your problem and I have the same problem in my document.
Can you post your function please.
Thanks
I dont know why but when you load an 3ds object into your szene you need to do any actions(like set xpos oder events) in the weldverticalandfaces function
Then it need to work
greez benji
|
 |
|
|
Mehrdad Sanjabi (aka Mehdadoo) kolhoz™ wrote:I have no idea how your project is constructed, so i talk assuming you wanna pass parameters to a .swf file you wanna use as MovieClipMaterial.
In your .swf file accept the parameters passed to it like this:
In your main file, where you wanna load it, include as many parameters as you'd like in the data property of the URLRequest object:
And if you can use a custom class extending movieClip, you can pass the parameter to it's constructor as the following code shows:
Again, although these codes solve your problem, you'll definitely be stuck using them, because no one knows what you actually want to do with it! Post a sample project!
Thank you very much for you great help. But i solved my problem on an other way.
I created an Interface to solve that problem for example:
public interface IPlayer{
function setParameter(value:int):void;
}
and in my swf class file i implement the interface and use its function
so now when i creat a box with my swf as a texture, on each time i create this box the parameter index will be set.
But thanks for help
|
 |
|
|
Hello,
i had an swf file where is a index var.
Now ive got a .as file which loads the swf over a loop.
and each time the loop is running, the index var should be +1
so my question how can i give an swf which is used as an interactive movieclipmaterial a parameter?
for example sth like that
public class swf extends Sprite {
[Embed (source="xmlloader1.swf?index ="thisIndex)]
private var clipLoaderClass:Class;
public function swf(index:int) {
thisIndex= index;
so everytime the class demo will be used you need to give the class an index parameter for the swf file.
Any idea how to solve this problem?
|
 |
|
|
Mehrdad Sanjabi (aka Mehdadoo) kolhoz™ wrote:It is correct.
Only by posting your own project it can be solved! Maybe there are some problems with project setting and not your code.
k if i write this
public var material:MovieClipMaterial = new MovieClipMaterial(animation, 301, 199, null, null, true, 10, 0x990000, 1);
instead of
public var material:MovieClipMaterial = new MovieClipMaterial(animation, animation.width, animation.height, null, null, true, 10, 0x990000, 1);
then i can see a white box.
but no texture and nothing else.
The funny thing is if i write
public var material:MovieClipMaterial = new MovieClipMaterial(animation, 100,200, null, null, true, 10, 0x990000, 1);
nothing will be shown
any idea why?
|
 |
|
|
Mehrdad Sanjabi (aka Mehdadoo) kolhoz™ wrote:Forget about MyMC, You are not using Adobe Flash at all.
Your code compiles all right,
You would save a lot of time, if you posted a project in the first post!
i posted aktually all informations
but here the whole code from my class
package flat
{
import alternativa.engine3d.core.Mesh;
import alternativa.engine3d.core.Object3D;
import alternativa.engine3d.core.Scene3D;
import alternativa.engine3d.events.MouseEvent3D;
import alternativa.engine3d.loaders.Loader3DS;
import alternativa.engine3d.materials.*;
import alternativa.engine3d.primitives.Box;
import alternativa.utils.MeshUtils;
import flash.display.MovieClip;
import flash.events.Event;
import flash.geom.Matrix;
public class Wall
{
private var xPos:int;
private var yPos:int;
private var zPos:int;
private var rotationn:int;
private var sz:Scene3D;
private var clip:MovieClip;
private var wand:Box;
// interactive version of typical swf/movieclip material setup
[Embed(source="xmlloader1.swf")] private static const screenAnimation:Class;
private static const animation:MovieClip = new screenAnimation();
public var material:MovieClipMaterial = new MovieClipMaterial(animation, animation.width, animation.height, null, null, true, 1, 0x000000, 1);
public function Wall(xPosl:int,yPosl:int,zPosl:int,rotationl:int, szene:Scene3D)
{
super();
xPos = xPosl;
yPos = yPosl;
zPos = zPosl;
sz = szene;
rotationn = rotationl;
wand = new Box(500,500,500,3,3,3);
wand.cloneMaterialToAllSurfaces(material);
wand.x = xPos;
wand.y = yPos;
wand.z = zPos;
sz.root.addChild(wand);
}
}
}
mfg benji
|
 |
|
|
Mehrdad Sanjabi (aka Mehdadoo) kolhoz™ wrote:In the Flash IDE, you can extend classes to create your own custom classes.
MyMC is a class extending flash.display.MovieClip. Because of inheritance, MyMC can be treated as MovieClips.
"var mc:MovieClip=new MovieClip();" creates a movieClip with no display objects in it.
"var mc:MovieClip=new MyMC();" creates an instance of a movieClip, already existing in the lash IDE's library.
whats is the lash IDE's library? and what must be in the myMC() class?
do you mean i should write an empty class which extends from movieclip?
|
 |
|
|
So i tried this :
private var wand:Box;
[Embed(source="xmlloader1.swf")] private static const screenAnimation:Class;
private static const animation:MovieClip = new screenAnimation();
public var material:MovieClipMaterial = new MovieClipMaterial(animation, animation.width, animation.height, null, null, true, 1, 0x000000, 1);
wand = new Box(500,500,500,3,3,3);
wand.cloneMaterialToAllSurfaces(material);
wand.x = xPos;
wand.y = yPos;
wand.z = zPos;
sz.root.addChild(wand);
this one way i tried to use the moveclipmaterial
but it wont work
any help will be nice
mfg benji
|
 |
|
|
Mehrdad Sanjabi (aka Mehdadoo) kolhoz™ wrote:You can wrap a 2D movieClip around your 3D geometry. Just like you'd do with a paper around a gift
and how i can do this?? i took a look at you demo and there 1 more question
i create a new movieclip like this
var mc:MovieClip=new MovieClip();
but u wrote
var mc:MovieClip=new MyMC();
what is MyMC();?
thats the point i dont understand
|
 |
|
|
How can i get the mc on my szene?
And is it possible to texture a 3d object like a box?
i dont understand how to use the movieclipmaterial
mfg benji benji
|
 |
|
|
Thanks anyway thats what i was looking for
Mehrdad Sanjabi (aka Mehdadoo) kolhoz™ wrote:The first parameter passed to the MovieClipMaterial, should be an instance of a MovieClip, shouldn't it? Box is not a movieClip.
This guy has experiences though
|
 |
|
|
Hello,
i got a class which loads a 3ds object on my szene.
now i want to texture it i created a movieclip material like this:
[Embed(source="../xmlloader1.swf")] private static const swfClip:Class;
private static const clip:MovieClip = new swfClip();
for loading the 3ds object
wandLoader = new Loader3DS();
wandLoader.smooth = true;
wandLoader.precision = TextureMaterialPrecision.HIGH;
wandLoader.load("resource/wand/wand1.3DS");
wandLoader.addEventListener(Event.COMPLETE, onWandloadingComplete);
now i want to texture this object with an interactive swf
i read that i n to use the movieclipmaterial.
But how can i assign the swf texture on my 3dsobject?
i tried another way like this
var clipWidth:int = 320;
var clipHeight:int = 200;
var matrix:Matrix = new Matrix(1, 0, 0, clipWidth/clipHeight);
var material:MovieClipMaterial = new MovieClipMaterial(clip, clipWidth, clipWidth, null, matrix);
wand = new Box(100,10,100,1,1,1,true,true);
var material:MovieClipMaterial = new MovieClipMaterial(wand, clipWidth, clipWidth, null, matrix);
but the problem is that the "wand" is not a movieclip its a box
same problem like in the first step/way i tried.
any idea? thx anyway for help
if you need some more information just tell me
mfg benji benji
|
 |
|
|
Mehrdad Sanjabi (aka Mehdadoo) kolhoz™ wrote:You can not add an arbitrary class like the Event class to the scene, can you? Only instances of Object3d are supposed to be passes to the addChild() method of a 3d scene
Your class must extend the same Object3D.
And if you bother posting a project, we don't need to create everything from scratch to show you what we mean!
yeah youre right. I tought at the wrong way i solved it on other way but thx for help.
I didn´t need to parse it into an object3d
but thanks anyway
|
 |
|
|
can you give me maybe a small codesnipet? i dont understand what to do with this class or how to use it?
how can this help to solve my problem?
mfg Benji benji
|
 |
|
|
Hello,
i created a class were i create a 3 object and load its informations
now i want to create an object from this class and add this object to the scene
but i get the error message: class "wall" is not a object 3d...
how can i parse it into a 3d object?
if i try "wall as object 3D" theres no error before starting, after starting i get the error that he cant add a empty object on scene.
here are the code snipet
//Here i want to add the class on scene:
wall1 = new wall(10,10,10,0);
scene.root.addChild(wall1);
//here code from class wall
public function wall(xPosl:int,yPosl:int,zPosl:int,rotationl:int)
{
xPos = xPosl;
yPos = yPosl;
zPos = zPosl;
rotation = rotationl;
wandLoader = new Loader3DS();
wandLoader.smooth = true;
wandLoader.precision = TextureMaterialPrecision.HIGH;
wandLoader.load("resource/wand/wand2.3DS");
wandLoader.scale = 0.2; // Danou verkleinert
wandLoader.addEventListener(Event.COMPLETE, onWandloadingComplete);//parameterübergabe
}
private function onWandloadingComplete(e:Event) {
for (var o:* in wandLoader.content.children) {
var object:Object3D = o;
weldVerticesAndFaces(object);
//scene.root.addChild(object);
//scene vorhanden?
}
}
private function weldVerticesAndFaces(object:Object3D):void {
if (object is Mesh) {
MeshUtils.autoWeldVertices(Mesh(object), 0.01);
MeshUtils.autoWeldFaces(Mesh(object), 0.01, 0.001);
}
// Launching procedure for object's children for wall1
for (var key:* in object.children) {
weldVerticesAndFaces(key);
}
object.x = xPos;
object.y = yPos;
object.z = zPos;
object.rotationZ =rotation;
// funktion on klick
object.addEventListener(MouseEvent3D.MOUSE_DOWN, onSWF);
}
any idea how i can solve that problem?
mfg Benji benji
|
 |
|
|
how can i setting that the camera wont swirl top and down
here my function init()
private function initScene():void {
// Scene creation
scene = new Scene3D();
scene.root = new Object3D();
// Adding camera and viewport
camera = new Camera3D();
camera.rotationX = - MathUtils.DEG90;
camera.fov = MathUtils.toRadian(110);
view = new View();
addChild(view);
view.camera = camera;
view.interactive = true;
// Camera container
container = new Object3D();
container.addChild(camera);
// container.z += 1000;
scene.root.addChild(container);
// Adding inside view controller
controller = new WalkController(stage);
controller.object = container;
// controller.lookAt(ch);
controller.speed = 125; // Ursprünglich ca. 50
controller.maxGroundAngle = MathUtils.DEG1; // DEG45;
controller.speedThreshold = 1;
controller.checkCollisions = true;
controller.collider.radiusX = 5;
controller.collider.radiusY = 5;
controller.collider.radiusZ = 30; // Danou: Abstand vom Boden
// controller.gravity public machen und dann in die private function onLoadingComplete verschieben
controller.collider.offsetThreshold = 0.0001;
// controller.coords = new Point3D(0, -1200, 20); // Danou final Startpunkt vor Tempel
controller.coords = new Point3D(0, 200, 50); // Startpunkt mitten im Tempel
controller.onStartMoving = setLowQuality;
controller.onStopMoving = startHighQualityTimer;
controller.setDefaultBindings();
controller.bindKey(KeyboardUtils.UP, ObjectController.ACTION_FORWARD);
controller.bindKey(KeyboardUtils.DOWN, ObjectController.ACTION_BACK);
controller.bindKey(KeyboardUtils.LEFT, ObjectController.ACTION_LEFT);
controller.bindKey(KeyboardUtils.RIGHT, ObjectController.ACTION_RIGHT);
controller.objectZPosition = 0.95;
currentController = controller;
// Adding outside view controller
controllerOut = new WalkController(stage);
controllerOut.object = container;
flatModel.coords.x = 0; // Danou verändert
// flatModel.coords.y = 4400;
flatModel.coords.y = 1400; // Danou verändert
flatModel.coords.z = 0;
controllerOut.lookAt(flatModel.coords);
controllerOut.speed = 25;
controllerOut.checkCollisions = true;
controllerOut.coords = new Point3D(25, -1500, 10);
controllerOut.onStartMoving = setLowQuality;
controllerOut.onStopMoving = startHighQualityTimer;
controllerOut.objectZPosition = 5;
controllerOut.setDefaultBindings();
controllerOut.bindKey(KeyboardUtils.W, ObjectController.ACTION_PITCH_UP);
controllerOut.bindKey(KeyboardUtils.S, ObjectController.ACTION_PITCH_DOWN);
controllerOut.bindKey(KeyboardUtils.A, ObjectController.ACTION_YAW_LEFT);
controllerOut.bindKey(KeyboardUtils.D, ObjectController.ACTION_YAW_RIGHT);
}
any ideas?
mfg benji
|
 |
|
|
|
|