【http://www.newflash3d.com---flash3D先锋队:北京贝武易科技公司】
有疑问请联系我QQ:363596350
这是我第一个对WOWengine动力学的学习,在这里总结一下,先看看结果。
papervision3d与WOWengine很好结合到一起了。
看看代码:
package {
import flash.events.Event;
import fr.seraf.wow.core.WOWEngine;
import fr.seraf.wow.core.data.WVector;
import fr.seraf.wow.primitive.WBoundArea;
import fr.seraf.wow.primitive.WSphere;
import org.papervision3d.cameras.*;
import org.papervision3d.materials.WireframeMaterial;
import org.papervision3d.materials.utils.MaterialsList;
import org.papervision3d.objects.primitives.Cube;
import org.papervision3d.objects.primitives.Sphere;
import org.papervision3d.view.BasicView;
[SWF(width="640", height="480", frameRate="30", backgroundColor="#333333")]
public class Wow extends BasicView {
private var wow:WOWEngine;
private var wSphere1:WSphere;
private var wSphere2:WSphere;
private var bound:WBoundArea;
private var ball1:Sphere;
private var ball2:Sphere;
private var box:Cube;
public function Wow() {
super(0, 0, true, true, CameraType.TARGET);
init();
}
private function init():void {
camera.x = 0;
camera.y = 0;
camera.z = -400;
camera.focus = 400;
camera.zoom = 1;
createBox();
createBall();
initWow();
startRendering();
}
private function initWow():void {
wow = new WOWEngine(.4);
wow.collisionResponseMode = wow.SELECTIVE;
wow.addMasslessForce(new WVector(1,3,1));
wow.damping=0.98;
wSphere1 = new WSphere(0,0,0,10, false, 1.2, 0.4);
wSphere2 = new WSphere(0,10,0,10, false, 1, 0.3);
wow.addParticle(wSphere1);
wow.addParticle(wSphere2);
bound = new WBoundArea(200,200,200);
bound.setPosition(0,0,0);
bound.elasticity=0.1;
bound.friction=0.01;
wow.setBoundArea(bound);
}
private function createBox():void {
var materials:MaterialsList = new MaterialsList({
all: new WireframeMaterial(0xffffff, 1)
} );
box = new Cube(materials, 200, 200, 200, 2, 2, 2, Cube.ALL, Cube.NONE);
scene.addChild(box);
}
private function createBall():void {
ball1 = new Sphere(new WireframeMaterial(0xff00ff, 1), 10);
ball2 = new Sphere(new WireframeMaterial(0xff00ff, 1), 10);
scene.addChild(ball1);
scene.addChild(ball2);
}
override protected function onRenderTick(event:Event=null):void {
var wVec:WVector = bound.getRotation();
var rx:Number = wVec.x + 1;
var ry:Number = wVec.y + 1;
bound.setRotation(rx,ry,0);
wow.step();
// Set pos ref to wow
box.rotationX = wVec.x;
box.rotationY = wVec.y;
box.rotationZ = 0;
ball1.x = wSphere1.px;
ball1.y = -wSphere1.py;
ball1.z = wSphere1.pz;
ball2.x = wSphere2.px;
ball2.y = -wSphere2.py;
ball2.z = wSphere2.pz;
super.onRenderTick(event);
}
}
}
代码分析:
从根本意义上来说,WOWengine只是以嵌入的方式加入到Papervision3d中的,它的还是自己的运算规律,自己的东西,而把Papervision3d的物体捆绑到它上面去。
- 大小: 124.1 KB
分享到:
相关推荐
同时,基于真实世界的实验数据和仿真结果的对比分析,也是车辆动力学研究中不可或缺的一环。 教材中也反复强调了信息使用和存储的安全问题,即在当前的法律框架下,任何未经授权的信息复制或传播行为都可能面临法律...
Title: 3D Engine Design for Virtual Globes Author: Kevin Ring, Patrick Cozzi Length: 520 pages Edition: 1 Language: English Publisher: A K Peters/CRC Press Publication Date: 2011-06-24 ISBN-10: ...
1 Radiation 1 1.1 The Early History of Electricity and Magnetism 1 1.2 James Clerk Maxwell, The Union of Electricity and Magnetism 8 1.3 Radiation by Accelerated Charge 10 1.4 Reactive and Radiating ...
Qt 3D是Qt框架中用于3D图形和渲染的应用程序编程接口(API),它的主要目标是提供一个跨平台的解决方案,用于在软件中实现3D内容的展示和交互。该技术适用于游戏开发、模拟系统、数据可视化以及任何需要3D图形显示的...
《Direct3D 9 Basics》是一本专注于游戏编程的书籍,主要讲解了使用Direct3D 9技术进行游戏开发的基础知识。Direct3D是微软公司为Windows操作系统开发的一个图形应用程序接口(API),它允许程序员创建高性能的3D...
CityEngine能够与ArcGIS平台紧密结合,支持导入GIS数据,如Shapefile、GeoJSON等,将地理信息与3D模型结合,实现地理空间分析和可视化。 ### 6. 渲染与输出 学习如何设置光照、材质、纹理,以及相机视角,以优化...
- **场景构建与细节完善**:通过实际项目练习,从零开始构建一个完整的3D场景,包括场景规划、建模、材质贴图、灯光设置等步骤。 - **角色设计与动画**:专注于角色模型的设计与制作,包括面部表情、肢体动作等方面...
本文将基于Oracle官方文档《Oracle Database Backup and Recovery Basics 10g Release 1 (10.1)》的内容,详细介绍Oracle数据库备份与恢复的基础概念和技术。 #### 二、备份与恢复的重要性 备份是指将数据存储为...
Learn the basics of 3D applications: vertices, faces, meshes, cameras, and renderers Learn how to set up a Three.js web app: the scene, camera, and renderer Master the scene hierarchy and child-parent...
Direct3D 作为 DirectX 的核心组件之一,是进行 3D 图形编程的重要工具。 #### 3D 图形简介与 Direct3D 定位 3D 图形是指在计算机中表示和渲染三维空间中的物体的技术。Direct3D 在 3D 图形领域扮演着至关重要的...
Learn Autodesk Inventor 2018 Basics 3D Modeling, 2D Graphics, and Assembly Design 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者...
Using a straightforward, step-by-step approach and practical examples, the course will take you from the absolute basics through to sophisticated game physics, animations, and other techniques. ...
iOS 11 Programming Fundamentals with Swift Swift, Xcode, and Cocoa Basics 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
S7 Array and Indirect Addressing Examples and Basics.zip西门子PLC编程S7 Array and Indirect Addressing Examples and Basics.zip西门子PLC编程S7 Array and Indirect Addressing Examples and Basics.zip西门子...
Learning C++ by Building Games with Unreal Engine 4: A beginner’s guide to learning 3D game development with C++ and UE4, 2nd Edition by Sharan Volin--July 1, 2019 English | 2018 | ISBN: 1788476249 |...
, OGRE 3D, an open source Object-Oriented 3D Graphics Rendering Engine written in C++, which can be utilized to create a variety of 3D applications and is commonly used in game creation, can help you ...