这个语言大小写不敏感
执行代码的方式:
Reflection.executeFile(“d:/algodoo_workspace/test1/add_ball.phn”)
Scence.entityById(32).color //不行
(Scence.entityById(32)).color //行
一个必要且有用的操作,右键一个entity, Script脚本选单, 这个属性的窗口是可以独立出来, 还可以多个entity分别展示,很有用
(Scene.entityById(29)).color = [2,2,2,2] //属性赋值
耳机坏了没心情
print (“hello world”) 是这么写的.
onclick也是字面意思. 在运行场景的时候,点这个entity就会触发onclick事件
sence.my 是个特别的东西
相当于一个全局变量的集合.
scene.my.xx = 111; 是定义了一个全局变量xx, 可以在其他事件中使用
onkey包含了onkeydown和onkeyup
(在这个窗口中改东西是实时生效的,真不错)
控制台直接定义变量 xx=“66”
onclick中直接print(xx) 是可以的. 那my 有什么特别的?
需要的场景是没有没有重力的二维世界.找了下没有俯视的图,但一想,没有重力不就是俯视嘛.
sim.gravityswitch = false
场景就有了 不, 是stage就有了
场景是一个围墙,走路的摩擦力很大(空气阻力很大),然后撞到墙
首先力好像没这个东西, 有tools.dragtool 但这个要鼠标拖动触发
(scene.entitybyid(2510)).vel = [10,10]
可以给entity一个速度,然后因为摩擦力速度会递减
sim.airFrictionMultiplier = 85 //空气摩擦力
场景的代码如下
// FileVersion 21
// Algodoo scene created by Algodoo v2.1.0
FileInfo -> {
title = "drag_test5";
author = "UnityDogGaming04";
version = 21
};
Sim -> {
gravitySwitch = false;
gravityStrength = 9.8000002;
gravityAngleOffset = 0.00000000;
airSwitch = true;
airFrictionMultiplier = 85.000000;
airFrictionLinear = 0.0099999998;
airFrictionQuadratic = 0.0010000000;
rotFrictionLinear = 0.031399999;
airDensity = 0.0099999998;
windStrength = 0.00000000;
windAngle = 0.00000000;
airFrictionVersion = 3;
legacyMode = 2;
timeFactor = 1.0000000;
geomAttraction = true;
multipleContactEventPerPair = false;
collideCallbacksEveryStep = true;
scriptUpdatesEveryStep = true;
cables = false;
limitAngVel = 0.25000000;
directContactSolveAll = false;
direct_friction = false;
directHingeSolve = true;
directSpringSolve = false;
solveIter = 30;
directSolveIters = 3;
dsFirst = true;
dsLast = true;
iterativeContactsToo = true;
iterativeHingesToo = true;
iterativeSpringsToo = true;
pureIterativeFinish = true;
direct_lcp = true;
mlcp_tolerance = 1.0000000e-006;
mlcp_maxIter = 7;
positionsLast = true;
timeFactor = 1.0000000;
frequency = 60.000000;
targetPenetration = 9.9999997e-005
};
Palette -> {
opaqueBorders = true;
drawCircleCakes = true;
ruler = false;
showForces = false;
protractor = false;
colorRangesHSVA = [[[152.00000, 0.00000000, 0.62500000, 1.0000000], [152.00000, 0.020000000, 1.0000000, 1.0000000]]];
showMomentums = false;
texture = "";
showVelocities = false;
drawClouds = false;
borders = true;
skyColor = [0.091200002, 0.19000000, 0.17353332, 1.0000000];
waterColor = [0.28710002, 0.69712502, 0.99000001, 0.69999999]
};
App -> {
showGravityField = false;
scaleGravityField = false;
laserEvents = true;
numColorsInRainbow = 12;
laserSuperBoost = 1.0000000;
laserResolution = 10.000000;
laserFuzziness = 0.69999999;
tracerFuzziness = 0;
waterColor = [0.28710002, 0.69712502, 0.99000001, 0.69999999];
fadeColor = [0.00000000, 0.00000000, 0.00000000];
borderWidth = 0.029999999;
borderSelectedWidthFactor = 5.0000000;
currentPalette = "Chalkboard"
};
App.GUI -> {
drawHingesWhenRunning = true
};
Scene -> {
gravityRotationOffset = NaN;
textures = [];
sounds = []
};
Accelerometer -> {
useAccelerometer = false
};
SPH -> {
vaporizeTime = +inf;
viscosity = 0.00000000;
solveT_dens = 0.050000001
};
App.Grid -> {
base = 4;
snap = true;
opacity = 1;
grid = false;
topness = 0.50000000;
numAxes = 2;
scale = 2.0000000
};
App.GUI.Forces -> {
gravity = true;
gravityText = "mg";
externalText = "ext";
hasTorqueScale = false;
attraction = true;
angMomScale = 1.0000000;
airBuoyancyText = "air lift";
total = false;
rotation = false;
frictionProjection = true;
normalText = "N";
drawForces = false;
external = true;
hasVelScale = false;
drawMomentums = false;
springText = "spring";
torqueScale = 0.10000000;
thruster = true;
drawComponents = false;
normal = true;
hasForceScale = false;
angularMomentumText = "L";
airFriction = true;
forceScale = 0.10000000;
hasAngVelScale = false;
torque = true;
friction = true;
chainText = "C";
velScale = 1.0000000;
hingeText = "A";
drawValues = false;
frictionText = "T";
contactCombinationDistance = 1.2000000;
attractionText = "G";
maxArrowLength = 0.34999999;
hasMomScale = false;
angularMomentum = false;
thrusterText = "ext";
spring = true;
angVelScale = 1.0000000;
chain = true;
linearMomentumText = "p";
velocities = false;
drawAngles = false;
hinge = true;
airBuoyancy = true;
hasAngMomScale = false;
momScale = 1;
airFrictionText = "air friction";
totalText = "Σ";
drawNames = true;
torqueText = "τ"
};
Tools.DragTool -> {
drawStrength = true;
dragMode = true;
maxForce = +inf;
allowZoom = true;
centerOfMass = false;
drawLine = true;
hotkey = "d";
allowPan = false;
strength = 10000000.;
smartAttachRad = 1.0000000;
noRot = false;
solveD = 2418
};
Scene.Camera -> {
pan = [2.3198869, 1.3731679];
rotation = 0.00000000;
trackRotation = false;
zoom = 77.108612
};
App.Background -> {
cloudOpacity = 0.60000002;
drawClouds = false;
skyColor = [0.091200002, 0.19000000, 0.17353332, 1.0000000]
};
Scene.addLayer {
visible := true;
color := [1.0000000, 1.0000000, 1.0000000, 1.0000000];
id := 0;
dynamic := true
};
Scene.addPlane {
collideWater := true;
color := [0.62500000, 0.62500000, 0.62500000, 1.0000000];
onCollide := (e)=>{};
attraction := 0.00000000;
onHitByLaser := (e)=>{};
heteroCollide := false;
immortal := true;
opaqueBorders := true;
refractiveIndex := 1.5000000;
killer := true;
timeToLive := +inf;
update := (e)=>{};
angle := 0.00000000;
geomID := 13526780;
friction := 0.50000000;
materialName := "";
restitution := 0.50000000;
entityID := 2403;
zDepth := 0.00000000;
onSpawn := (e)=>{};
resources := [];
pos := [-1000.0000, -0.00000000];
drawBorder := true;
edgeBlur := 0.00000000;
body := 0;
textureClamped := [false, false];
adhesion := 0.00000000;
reflectiveness := 1.0000000;
onDie := (e)=>{};
onClick := (e)=>{};
postStep := (e)=>{};
textureMatrix := [1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000];
texture := "";
collideSet := 1023;
onKey := (e)=>{};
glued := false;
colorHSVA := [152.00000, 0.00000000, 0.62500000, 1.0000000];
materialVelocity := 0.00000000;
attractionType := 2;
layer := 0
};
Scene.addPlane {
collideWater := true;
color := [0.62500000, 0.62500000, 0.62500000, 1.0000000];
onCollide := (e)=>{};
attraction := 0.00000000;
onHitByLaser := (e)=>{};
heteroCollide := false;
immortal := true;
opaqueBorders := true;
refractiveIndex := 1.5000000;
killer := true;
timeToLive := +inf;
update := (e)=>{};
angle := 1.5707964;
geomID := 13526781;
friction := 0.50000000;
materialName := "";
restitution := 0.50000000;
entityID := 2404;
zDepth := 1.0000000;
onSpawn := (e)=>{};
resources := [];
pos := [-0.00000000, -1000.0000];
drawBorder := true;
edgeBlur := 0.00000000;
body := 0;
textureClamped := [false, false];
adhesion := 0.00000000;
reflectiveness := 1.0000000;
onDie := (e)=>{};
onClick := (e)=>{};
postStep := (e)=>{};
textureMatrix := [1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000];
texture := "";
collideSet := 1023;
onKey := (e)=>{};
glued := false;
colorHSVA := [152.00000, 0.00000000, 0.62500000, 1.0000000];
materialVelocity := 0.00000000;
attractionType := 2;
layer := 0
};
Scene.addPlane {
collideWater := true;
color := [0.62500000, 0.62500000, 0.62500000, 1.0000000];
onCollide := (e)=>{};
attraction := 0.00000000;
onHitByLaser := (e)=>{};
heteroCollide := false;
immortal := true;
opaqueBorders := true;
refractiveIndex := 1.5000000;
killer := true;
timeToLive := +inf;
update := (e)=>{};
angle := 3.1415927;
geomID := 13526782;
friction := 0.50000000;
materialName := "";
restitution := 0.50000000;
entityID := 2405;
zDepth := 2.0000000;
onSpawn := (e)=>{};
resources := [];
pos := [1000.0000, -0.00000000];
drawBorder := true;
edgeBlur := 0.00000000;
body := 0;
textureClamped := [false, false];
adhesion := 0.00000000;
reflectiveness := 1.0000000;
onDie := (e)=>{};
onClick := (e)=>{};
postStep := (e)=>{};
textureMatrix := [1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000];
texture := "";
collideSet := 1023;
onKey := (e)=>{};
glued := false;
colorHSVA := [152.00000, 0.00000000, 0.62500000, 1.0000000];
materialVelocity := 0.00000000;
attractionType := 2;
layer := 0
};
Scene.addPlane {
collideWater := true;
color := [0.62500000, 0.62500000, 0.62500000, 1.0000000];
onCollide := (e)=>{};
attraction := 0.00000000;
onHitByLaser := (e)=>{};
heteroCollide := false;
immortal := true;
opaqueBorders := true;
refractiveIndex := 1.5000000;
killer := true;
timeToLive := +inf;
update := (e)=>{};
angle := -1.5707964;
geomID := 13526783;
friction := 0.50000000;
materialName := "";
restitution := 0.50000000;
entityID := 2406;
zDepth := 3.0000000;
onSpawn := (e)=>{};
resources := [];
pos := [-0.00000000, 1000.0000];
drawBorder := true;
edgeBlur := 0.00000000;
body := 0;
textureClamped := [false, false];
adhesion := 0.00000000;
reflectiveness := 1.0000000;
onDie := (e)=>{};
onClick := (e)=>{};
postStep := (e)=>{};
textureMatrix := [1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000];
texture := "";
collideSet := 1023;
onKey := (e)=>{};
glued := false;
colorHSVA := [152.00000, 0.00000000, 0.62500000, 1.0000000];
materialVelocity := 0.00000000;
attractionType := 2;
layer := 0
};
Scene.addPlane {
collideWater := true;
color := [0.67619997, 0.69000000, 0.68356001, 1.0000000];
onCollide := (e)=>{};
attraction := 0.00000000;
onHitByLaser := (e)=>{};
heteroCollide := false;
immortal := false;
opaqueBorders := true;
refractiveIndex := 1.5000000;
killer := false;
timeToLive := +inf;
update := (e)=>{};
angle := 1.5707964;
geomID := 13526784;
friction := 0.50000000;
materialName := "";
restitution := 0.50000000;
entityID := 2407;
zDepth := 4.0000000;
onSpawn := (e)=>{};
resources := [];
pos := [-0.00000000, -0.00000000];
drawBorder := true;
edgeBlur := 0.00000000;
body := 0;
textureClamped := [false, false];
adhesion := 0.00000000;
reflectiveness := 1.0000000;
onDie := (e)=>{};
onClick := (e)=>{};
postStep := (e)=>{};
textureMatrix := [1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000];
texture := "";
collideSet := 1023;
onKey := (e)=>{};
glued := false;
colorHSVA := [152.00000, 0.020000000, 0.69000000, 1.0000000];
materialVelocity := 0.00000000;
attractionType := 2;
layer := 0
};
Scene.addCircle {
inertiaMultiplier := 1.0000000;
resources := [];
timeToLive := +inf;
textureClamped := [false, false];
adhesion := 0.00000000;
attractionType := 2;
attraction := 0.00000000;
texture := "";
update := (e)=>{};
controllerInvertX := false;
controllerInvertY := false;
showMomentum := false;
vel := [0.00000000, 0.00000000];
restitution := 0.50000000;
onCollide := (e)=>{};
killer := false;
materialVelocity := 0.00000000;
showForceArrows := false;
controllerReverseXY := false;
refractiveIndex := 1.5000000;
textureMatrix := [1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000];
protractor := false;
immortal := false;
area := 0.36316815;
collideSet := 1;
drawBorder := true;
reflectiveness := 1.0000000;
friction := 0.50000000;
entityID := 2418;
velocityDamping := [0.00000000, 0.00000000, 0.00000000];
onClick := (e)=>{};
color := [0.73396397, 0.74808079, 0.74149293, 1.0000000];
collideWater := true;
onSpawn := (e)=>{};
materialName := "";
onHitByLaser := (e)=>{};
drawCake := true;
pos := [0.32998648, 1.6063319];
onDie := (e)=>{};
density := 2.0000000;
airFrictionMult := 1.0000000;
controllerAcc := 11.000000;
colorHSVA := [151.99995, 0.018870721, 0.74808079, 1.0000000];
radius := 0.34000000;
angvel := 0.00000000;
heteroCollide := false;
glued := false;
onKey := (e)=>{};
showVelocity := false;
postStep := (e)=>{};
opaqueBorders := true;
geomID := 13526795;
body := 13528866;
edgeBlur := 0.00000000;
angle := -0.60228741;
zDepth := 5.0000000;
layer := 0
};
Scene.addCircle {
inertiaMultiplier := 1.0000000;
resources := [];
timeToLive := +inf;
textureClamped := [false, false];
adhesion := 0.00000000;
attractionType := 2;
attraction := 0.00000000;
texture := "";
update := (e)=>{};
controllerInvertX := false;
controllerInvertY := false;
showMomentum := false;
vel := [0.00000000, 0.00000000];
restitution := 0.50000000;
onCollide := (e)=>{};
killer := false;
materialVelocity := 0.00000000;
showForceArrows := false;
controllerReverseXY := false;
refractiveIndex := 1.5000000;
textureMatrix := [1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000];
protractor := false;
immortal := false;
area := 0.19634955;
collideSet := 1;
drawBorder := true;
reflectiveness := 1.0000000;
friction := 0.50000000;
entityID := 2426;
velocityDamping := [0.00000000, 0.00000000, 0.00000000];
onClick := (e)=>{};
color := [0.73264521, 0.74077165, 0.73697931, 1.0000000];
collideWater := true;
onSpawn := (e)=>{};
materialName := "";
onHitByLaser := (e)=>{};
drawCake := true;
pos := [1.5399369, 2.1447310];
onDie := (e)=>{};
density := 2.0000000;
airFrictionMult := 1.0000000;
controllerAcc := 11.000000;
colorHSVA := [151.99994, 0.010970233, 0.74077165, 1.0000000];
radius := 0.25000000;
angvel := 0.00000000;
heteroCollide := false;
glued := false;
onKey := (e)=>{};
showVelocity := false;
postStep := (e)=>{};
opaqueBorders := true;
geomID := 13526803;
body := 13528875;
edgeBlur := 0.00000000;
angle := -1.0146304;
zDepth := 6.0000000;
layer := 0
};
Scene.addCircle {
inertiaMultiplier := 1.0000000;
resources := [];
timeToLive := +inf;
textureClamped := [false, false];
adhesion := 0.00000000;
attractionType := 2;
attraction := 0.00000000;
texture := "";
update := (e)=>{};
controllerInvertX := false;
controllerInvertY := false;
showMomentum := false;
vel := [-2.3628633e-007, 2.4187987e-011];
restitution := 0.50000000;
onCollide := (e)=>{};
killer := false;
materialVelocity := 0.00000000;
showForceArrows := false;
controllerReverseXY := false;
refractiveIndex := 1.5000000;
textureMatrix := [1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000];
protractor := false;
immortal := false;
area := 0.18095574;
collideSet := 1;
drawBorder := true;
reflectiveness := 1.0000000;
friction := 0.50000000;
entityID := 2510;
velocityDamping := [0.00000000, 0.00000000, 0.00000000];
onClick := (e)=>{};
color := [0.90043569, 0.91756988, 0.90957391, 1.0000000];
collideWater := true;
onSpawn := (e)=>{};
materialName := "";
onHitByLaser := (e)=>{};
drawCake := true;
pos := [3.6788743, 1.8140618];
onDie := (e)=>{};
density := 2.0000000;
airFrictionMult := 1.0000000;
controllerAcc := 11.000000;
colorHSVA := [151.99997, 0.018673444, 0.91756988, 1.0000000];
radius := 0.23999999;
angvel := -5.0720813e-025;
heteroCollide := false;
glued := false;
onKey := (e)=>{};
showVelocity := false;
postStep := (e)=>{};
opaqueBorders := true;
geomID := 13526887;
body := 13528960;
edgeBlur := 0.00000000;
angle := -1.0797893;
zDepth := 7.0000000;
layer := 0
};
Scene.addPlane {
collideWater := true;
color := [0.76440179, 0.77492678, 0.77001512, 1.0000000];
onCollide := (e)=>{};
attraction := 0.00000000;
onHitByLaser := (e)=>{};
heteroCollide := false;
immortal := false;
opaqueBorders := true;
refractiveIndex := 1.5000000;
killer := false;
timeToLive := +inf;
update := (e)=>{};
angle := -1.5707964;
geomID := 13527072;
friction := 0.50000000;
materialName := "";
restitution := 0.50000000;
entityID := 2626;
zDepth := 8.0000000;
onSpawn := (e)=>{};
resources := [];
pos := [-0.00000000, 4.3575568];
drawBorder := true;
edgeBlur := 0.00000000;
body := 0;
textureClamped := [false, false];
adhesion := 0.00000000;
reflectiveness := 1.0000000;
onDie := (e)=>{};
onClick := (e)=>{};
postStep := (e)=>{};
textureMatrix := [1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000];
texture := "";
collideSet := 1023;
onKey := (e)=>{};
glued := false;
colorHSVA := [152.00000, 0.013581913, 0.77492678, 1.0000000];
materialVelocity := 0.00000000;
attractionType := 2;
layer := 0
};
Scene.addPlane {
collideWater := true;
color := [0.81499660, 0.81820512, 0.81670779, 1.0000000];
onCollide := (e)=>{};
attraction := 0.00000000;
onHitByLaser := (e)=>{};
heteroCollide := false;
immortal := false;
opaqueBorders := true;
refractiveIndex := 1.5000000;
killer := false;
timeToLive := +inf;
update := (e)=>{};
angle := 3.1415927;
geomID := 13527099;
friction := 0.50000000;
materialName := "";
restitution := 0.50000000;
entityID := 2653;
zDepth := 9.0000000;
onSpawn := (e)=>{};
resources := [];
pos := [5.4506807, -0.00000000];
drawBorder := true;
edgeBlur := 0.00000000;
body := 0;
textureClamped := [false, false];
adhesion := 0.00000000;
reflectiveness := 1.0000000;
onDie := (e)=>{};
onClick := (e)=>{};
postStep := (e)=>{};
textureMatrix := [1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000];
texture := "";
collideSet := 1023;
onKey := (e)=>{};
glued := false;
colorHSVA := [151.99963, 0.0039214105, 0.81820512, 1.0000000];
materialVelocity := 0.00000000;
attractionType := 2;
layer := 0
};
Scene.addPlane {
collideWater := true;
color := [0.81539798, 0.83175129, 0.82411975, 1.0000000];
onCollide := (e)=>{};
attraction := 0.00000000;
onHitByLaser := (e)=>{};
heteroCollide := false;
immortal := false;
opaqueBorders := true;
refractiveIndex := 1.5000000;
killer := false;
timeToLive := +inf;
update := (e)=>{};
angle := 0.00000000;
geomID := 13527112;
friction := 0.50000000;
materialName := "";
restitution := 0.50000000;
entityID := 2666;
zDepth := 10.000000;
onSpawn := (e)=>{};
resources := [];
pos := [-2.3425181, -0.00000000];
drawBorder := true;
edgeBlur := 0.00000000;
body := 0;
textureClamped := [false, false];
adhesion := 0.00000000;
reflectiveness := 1.0000000;
onDie := (e)=>{};
onClick := (e)=>{};
postStep := (e)=>{};
textureMatrix := [1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000];
texture := "";
collideSet := 1023;
onKey := (e)=>{};
glued := false;
colorHSVA := [152.00002, 0.019661296, 0.83175129, 1.0000000];
materialVelocity := 0.00000000;
attractionType := 2;
layer := 0
};
Scene.addGroup {
name := "selected";
entityIDs := [2407]
};
直接在代码后面加(scene.entitybyid(2510)).vel = [10,0];
报错说#2510不存在 但确实是有的.
可能是没加载完.
控制台运行
(scene.entitybyid(2510)).vel = [10,0];
目的达到,场景模拟出来了.
剩下是学习能力
哦对了,通信