Following line
Line3Ds have a starting Vertex3D and an ending Vertex3D. You can simply update those vertices using the following properties to move the line around:
//starting line.v0.x = 0; line.v0.x = 0; line.v0.x = 0; //ending line.v1.x = 100; line.v1.x = 100; line.v1.x = 100;
package { import gs.TweenMax; import org.papervision3d.core.geom.Lines3D; import org.papervision3d.core.geom.renderables.Line3D; import org.papervision3d.core.geom.renderables.Vertex3D; import org.papervision3d.materials.WireframeMaterial; import org.papervision3d.materials.special.LineMaterial; import org.papervision3d.objects.primitives.Sphere; import org.papervision3d.view.BasicView; import org.papervision3d.view.stats.StatsView; [SWF(width="640", height="480", backgroundColor="#000000", frameRate="60")] public class LinesBetweenTwo3DPoints extends BasicView { private var sphere1:Sphere; private var sphere2:Sphere; private var line:Line3D; private var startVertex3D:Vertex3D; private var endVertex3D:Vertex3D; public function LinesBetweenTwo3DPoints() { var stats:StatsView = new StatsView(renderer); stats.x = 440; addChild(stats); var material:WireframeMaterial = new WireframeMaterial(0xcc0000); sphere1 = new Sphere(material, 50); sphere2 = new Sphere(material, 50); sphere2.x = 500; sphere2.y = 500; var lines:Lines3D = new Lines3D(); startVertex3D = new Vertex3D(sphere1.x, sphere1.y, sphere1.z); endVertex3D = new Vertex3D(sphere2.x, sphere2.y, sphere2.z); var lineMaterial:LineMaterial = new LineMaterial(0x00cc00); line = new Line3D(lines, lineMaterial, 4, startVertex3D, endVertex3D); lines.addLine(line); scene.addChild(sphere1); scene.addChild(sphere2); scene.addChild(lines); startRendering(); //Tween stuff var bezierThrough:Array = []; for(var i:int = 0; i < 10; i++) { var bezierPoint:Object = {}; bezierPoint.x = Math.random() * 1000 - 500; bezierPoint.y = Math.random() * 1000 - 500; bezierPoint.z = Math.random() * 500; bezierThrough.push(bezierPoint); } TweenMax.to(sphere2, 10, {x:500, y:500, z:0, bezierThrough:bezierThrough, loop:true, onUpdate:tweenUpdate}); } private function tweenUpdate():void { sphere1.lookAt(sphere2); //just for added efffect :) //v1 is the end point, so have it follow sphere2 line.v1.x = sphere2.x; line.v1.y = sphere2.y; line.v1.z = sphere2.z; } } }
-
Angel Kaido
-
Gabriel.Wang(From China)
-
Gabriel.Wang(From China)
-
John Lindquist
-
mannytan
Search
Recommended Books
Speaking at FITC Toronto
Recent Posts
- Moving to johnlindquist.com
- AsyncCommand with Robotlegs, Signals, Flight, MinimalComps
- Search Widget – Robotlegs, Signals, Flight, Minimal Comps, Yahoo Astra
- FDT Super Awesome March Deal
- haXe Tutorial
- AS3 Signals Tutorial
- Preferred Video Tutorial Resolution?
- TweenMax – Tweening a timeline (Advanced Tweening)
- Robotlegs + Flight + Union Platform
- Back in the saddle
- Eclipse Theme Designer Preview
- RobotLegs Hello World Video Tutorial
- 10 Things Every Senior Flash Developer Should Know
- Efflex – 3D Effects for Flex
- MorphController – Mighty Morphing Papervision3D
Recent Comments
- list of lpn courses on SpringCamera3D and Driving a Car
- rn to bsn in montgomery al on archive
- PowerPoint Recovery on Eclipse Theme Designer Preview
- cheat mw3 on Test if a plane is within the view of the camera (aka testing if culled)
- Goa Hotels on Looking around the inside of a Sphere
- cheat gratuit on Looking around the inside of a Sphere
- Application Development on Robotlegs + Flight + Union Platform
- nexium on Moving Faces
- buy nexium on Holy Sphere
- buy aldara online on Tweening a “moveForward()” behavior
Categories
Archives
Preferred Video Tutorial Resolution
- 1024x768 (53%, 85 Votes)
- 1280x1024 (15%, 24 Votes)
- 1920x1080 (15%, 24 Votes)
- 800x600 (13%, 20 Votes)
- 480x320 (4%, 6 Votes)
- 640x480 (0%, 2 Votes)
Total Voters: 160


