AggrorJorn Posted December 30, 2009 Posted December 30, 2009 I'm trying to push an object forward. To do this I use the AddForceAddPoint command. I've searched the rest of the forum and I kind a get stuck with difining the force. pick=CameraPick(camera,Vec3(GraphicsWidth()/2,GraphicsHeight()/2,2.0),0,0) if pick~=nil then if MouseDown(1)==1 then centerY=(GraphicsHeight()/2) if (centerY >= currentY) then texty = 1 campos = EntityPosition(fw.main.camera); force= Vec3(pick.x-campos.x,pick.y-campos.y,pick.z-campos.z) NormalizeVec3(force); force.x=10 force.y=0 force.z=0 entity:AddForceAtPoint(force,pick.entity) When I hold down the left mouse button and try to move a box, I recieve the error: index for obect is a valid filed or method. Can someone tell me what I'm doing wrong here? Quote
AndyGFX Posted December 30, 2009 Posted December 30, 2009 Change fw.main.camera to fw.Main.camera, when you have updated SDK from today. Quote [HW] C2D Q6600, 4GB RAM, NV8800GTX, Vista Ultimate x64 [sW] Blide Plus, BlitzMax, Delphi, C++, 3DWS 5.53, Leadwerks 2.xx
macklebee Posted December 30, 2009 Posted December 30, 2009 also the position of the pick appears to be pick.position with pick.position.x, pick.position.y, and pick.position.z Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel
AggrorJorn Posted December 31, 2009 Author Posted December 31, 2009 Change fw.main.camera to fw.Main.camera, when you have updated SDK from today. Good to know, but that wasn't the problem I think. Quote
AggrorJorn Posted December 31, 2009 Author Posted December 31, 2009 also the position of the pick appears to be pick.position with pick.position.x, pick.position.y, and pick.position.z Doe you mean that the pick arguments are wrong? If so, what should they be? Quote
macklebee Posted December 31, 2009 Posted December 31, 2009 Good to know, but that wasn't the problem I think. depends if you are running it outside of the editor or inside... outside appears to require uppercase and inside the editor requires lowercase also this line: entity:AddForceAtPoint(force,pick.entity) will not work... that command is looking for two Vec3's... so its looking for this: entity:AddForceAtPoint(force,pick.position) Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel
Rick Posted December 31, 2009 Posted December 31, 2009 depends if you are running it outside of the editor or inside... outside appears to require uppercase and inside the editor requires lowercase So what is this all about? Are you saying if I run from engine.exe vs editor.exe the case is different? That's not cool. Quote
AggrorJorn Posted December 31, 2009 Author Posted December 31, 2009 Is this upper/lower case effecting other commands as well? Quote
AggrorJorn Posted January 1, 2010 Author Posted January 1, 2010 I forgot to mention that the script editor selects the following line after the error: index for obect is a valid filed or method. force=Vec3(pick.x-campos.x,pick.y-campos.y,pick.z-campos.z)] Quote
macklebee Posted January 1, 2010 Posted January 1, 2010 I forgot to mention that the script editor selects the following line after the error: index for obect is a valid filed or method. force=Vec3(pick.x-campos.x,pick.y-campos.y,pick.z-campos.z)] thats why i told you above that the position of a pick is pick.position with pick.position.x, pick.position.y, and pick.position.z as its components... there is no pick.x. pick.z... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel
AggrorJorn Posted January 1, 2010 Author Posted January 1, 2010 thats why i told you above that the position of a pick is pick.position with pick.position.x, pick.position.y, and pick.position.z as its components... there is no pick.x. pick.z... sorry, I'm not so good with this yet. Thanks for the help it's working now Quote
macklebee Posted January 1, 2010 Posted January 1, 2010 sorry, I'm not so good with this yet. Thanks for the help it's working now no problem... i didn't realize you did not understand my post above... i see that you had asked about it, but i missed it. 1 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.