|
ahmedelshfie, Newbie
Posted: 16 November 2011 05:14 PM Total Posts: 10
Hello guys,
I need help to know how i can make object move automatic 360 degree, for example if i want make the earth move round the moon complete, how i can do it, what i need to import from away3d classes also what code i need to typing at actionscript for earth move?
Best,
|
ahmedelshfie, Newbie
Posted: 17 November 2011 04:39 PM Total Posts: 10
[ # 1 ]
Hello,
Please if any one have idea how i can make the moon rotate round the earth, or any example show this i search a lot to find example help me to done this point.
Thanks in advance,
|
maddog, Sr. Member
Posted: 17 November 2011 07:11 PM Total Posts: 118
[ # 2 ]
set earth as pivotpoint for moon then rotationX for moon. Note moon.pivotPoint(vector3d) only works in away3d3.x right now. At least for me.
use onEnterFrame for moon.rotationX +=.5;
|
ahmedelshfie, Newbie
Posted: 18 November 2011 06:45 PM Total Posts: 10
[ # 3 ]
Thanks too much about help, but i still no understand a point, the point is i need import any class from away3d or no?, also if have any exmaple please will be more helpful for me can understand what i really need to do.
Thanks again for help.
Best,
|
maddog, Sr. Member
Posted: 18 November 2011 08:39 PM Total Posts: 118
[ # 4 ]
|
ahmedelshfie, Newbie
Posted: 18 November 2011 10:59 PM Total Posts: 10
[ # 5 ]
maddog, thanks again for help, well, about set away3d classes at flash, flash builder i do it, sorry my English is bad, however i done project and every thing work fine with me i really need to you explain for me the code that i can make moon rotate automatic without i drag by mouse, i test you code but flash report me with many errors i believe that i miss understand you explain could you please wrote what i need to add at action frame for moon rotate round earth automatic .
maddog, thanks again for help.
Best,
|
ahmedelshfie, Newbie
Posted: 21 November 2011 06:49 PM Total Posts: 10
[ # 6 ]
Hello again,
Well, after i add
roationX +=.5
is work but is rotate in hom place, i need to know how can make moon move completly round the earth, not rotate stopping, please i need really help in this point, any idea will be helpgul for me.
Thanks again
Best,
|
maddog, Sr. Member
Posted: 21 November 2011 07:24 PM Total Posts: 118
[ # 7 ]
Add earth and moon to a ObjectContainer3D
Then rotate ObjectContainer3D. If you don’t want earth to rotate set its rotation opposite of the ObjectContainer3D’s rotation.
—————————————————————————————————————
|
maddog, Sr. Member
Posted: 21 November 2011 08:39 PM Total Posts: 118
[ # 8 ]
or instead of rotating object
rotate camera instead
camera.panAngle += .5;
|
ahmedelshfie, Newbie
Posted: 23 November 2011 05:01 PM Total Posts: 10
[ # 9 ]
Hello again maddog
i add this code from make the earth round the sun forgive me i was not mean rotate earth, i was mean move round the sun, forgive me my english not help me, however i add this code:
var speed:Number = 0.05; var radius:Number = 50; var angle:Number = 0; var xpos:Number; var ypos:Number; var centerX:Number = stage.stageWidth / 2; var centerY:Number = stage.stageHeight / 2; /*graphics.lineStyle (2, 0xffffff); graphics.moveTo (centerX + radius, centerY);*/ addEventListener (Event.ENTER_FRAME, onEnterFrame); function onEnterFrame (event:Event):void { xpos = centerX + Math.cos(angle) * radius; ypos = centerY + Math.sin(angle) * radius; angle += speed; earth.x = xpos; earth.y = ypos; }
But still have problem the earth round but for up and down doesn’t move round the sun 360 degree like i want, i believe have some miss in code, please help for know how i achive move the earth round the sun 360 degree.
Best,
|
maddog, Sr. Member
Posted: 23 November 2011 05:29 PM Total Posts: 118
[ # 10 ]
swap locations for earth and sun. so sun is at 0,0,0 then instead of rotating earth around sun, rotate camera around center by camera.panAngle +=4;
you will have to add rotation to the sun and earth so they rotate right though.
—————————————————————————————————————
or put then both in a 3dObject and rotate the 3dObject
|
ahmedelshfie, Newbie
Posted: 23 November 2011 06:12 PM Total Posts: 10
[ # 11 ]
Hi maddog,
did you mean the code that i post at last post is wrong? or i dont need to use and i just do by way the explain, also im gonna post part from code that i think will need your help becouse still now i canĀ“t understand point 3dObject.
Here code:
var scene:Scene3D = new Scene3D(); var camera:HoverCamera3D = new HoverCamera3D({zoom:2, focus:200, distance:500}); camera.panAngle = -180; camera.tiltAngle = 15;
camera.hover(true); camera.yfactor = 1; var view:View3D = new View3D({scene:scene, camera:camera, renderer:Renderer.CORRECT_Z_ORDER});
addChild(view);
view.x = 400; view.y = 250;
function onEnterFrame(e:Event):void { var cameraSpeed:Number = 0.3; heavens.rotationY += -.1; xpos = centerX + Math.cos(angle) * radius; ypos = centerY + Math.sin(angle) * radius; angle += speed;
earth.x = xpos; earth.y = ypos; if (move) { camera.panAngle = cameraSpeed*(stage.mouseX - lastMouseX) + lastPanAngle; camera.tiltAngle = cameraSpeed * (stage.mouseY - lastMouseY) + lastTiltAngle; } camera.hover(); view.render(); if(skies) earth.rotationY += cameraSpeed; }
Please could you help me where and how i set 3d object to earth and sun.
Thanks too much for help.
Best,
|
|
ahmedelshfie, Newbie
Posted: 23 November 2011 10:01 PM Total Posts: 10
[ # 13 ]
Hello maddog,
Thanks for help, the URL that path in your post was helpful for me, from what i see in tutorial solution was front me all time, however thanks, have other point i was adding lens flare now the lens is disappear behind background image, i use in project actionscript as class document, im sure lens flare i work fine because when stop display background image the lens flare appear fine when background image run again lens flare disappear so i believe lens flare is work fine but is behind background image, please if have any idea to how i can make lens flare be front background image will be too helpful for me, by the way i use lens flare actionsript code as document class in adobe flash cs5.5,
Thank too much maddog,
Best,
|
maddog, Sr. Member
Posted: 24 November 2011 01:18 AM Total Posts: 118
[ # 14 ]
I don’t know anything about lens flares but you could try increasing the radius for the heavens sphere.
you could try this.
view.clipping = new FrustumClipping();//Coulld try this too
|
ahmedelshfie, Newbie
Posted: 24 November 2011 11:00 AM Total Posts: 10
[ # 15 ]
Hello maddog,
I believe you right about this point decrease performance, i do a thing i add background image at lens flare class, so is work fine and lens flare appear also background image appear, but background image quility is too bad change totally and i dont know why, however i tried find away to make quility be more good but no work, you have some ideas about this point, or any solve for this problem, by the way every thing work fine just quility change after i move code to lens flare class.
Thanks maddog
Best,
|