-
Posts
23,145 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by Josh
-
-
Fixed...it was just a small typo causing that problem.
-
My tests indicated touch move events were working correctly. (I printed out the events and could see the numbers corresponding to my input.) Do you have a test that proves otherwise? Drawing some squares on the screen under the touch positions would be a good way to demonstrate it.
-
It just calls AddForce(gravity) where gravity by default is 0,-9.8,0 times mass:
Vec3 force = (spaceship->GetPosition(true) - planet->GetPosition(true)) * spaceship->GetMass(); spaceship->AddForce(force);
Technically, gravity increases as you get closer to an object though, so it should really be something like this:
Vec3 force = (spaceship->GetPosition(true) - planet->GetPosition(true)) * spaceship->GetMass(); const float gravityrange = 100; force *= 1.0 - min(force.Length() / gravityrange,1.0); spaceship->AddForce(force);
If you do this in the UpdatePhysics callback or script function, it will only get called for active bodies, and it will be called once per physics update.
Fun physics fact: See how I multiplied the force by the object's mass? That's the reason a piano and a walnut will fall at the same speed (not counting wind resistance).
- 2
-
Ha!
Those are the files I just uploaded.
Windows 8 keeps changing the clock's time on me, randomly. Right now it says it is November 5 at 3:47 A.M. when it is really November 4th at 7:47. So those files must have been modified...tomorrow. Since those files are from the future, they will always be newer than the ones you have on your hard drive.
The problem will roll over in about 7 hours, once we catch up with the future.
-
Internally, the gravity value is just a force added to each active body. So if you have more complex logic like your describe, adding the force you want would be the only way.
-
The fix is uploaded. I will leave this topic open for a day or two before closing it. Thanks for being patient.
-
I believe I have the solution.
In AndroidActivity.java, replace onTouchEvent with this code:
@Override public boolean onTouchEvent(MotionEvent event) { Integer action,pointerIndex,pointerId; Float x,y; action = event.getAction(); pointerIndex = event.getActionIndex();//(action & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT; //index of this pointer x = event.getX(pointerIndex); y = event.getY(pointerIndex); pointerId = event.getPointerId(pointerIndex); switch (action & MotionEvent.ACTION_MASK){ case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_POINTER_DOWN: // Log.i("touchtest", "action_down " + pointerId.toString() + // "(" + x + "," + y + ")"); androidRenderer.touch(x, y, pointerId); break; case MotionEvent.ACTION_MOVE: for (int i = 0; i < event.getPointerCount(); i++) { Log.i("touchtest", "begin_move "); pointerId=event.getPointerId(i); x = event.getX(i); y = event.getY(i); //Log.i("touchtest", "action_move " + pointerId.toString() + // "(" + x + "," + y + ")"); androidRenderer.move(x, y, pointerIndex); } break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_POINTER_UP: //Log.i("touchtest", "action_up " + pointerId.toString() + "(" // + x + "," + y + ")"); androidRenderer.up(x, y, pointerId); break; } return true; }
In main.cpp replace the Java_com_leadwerks_leandroidb_AndroidRenderer_move function with this code:
JNIEXPORT void JNICALL Java_com_leadwerks_leandroidb_AndroidRenderer_move(JNIEnv * env, jobject obj, jfloat x, jfloat y, jint touchId) { if(touchId < 0) return; if (Leadwerks::Window::_TouchPosition[pointerIndex].x!=x || Leadwerks::Window::_TouchPosition[pointerIndex].y!=y) { Leadwerks3D::_TouchPosition[touchId].x = x; Leadwerks3D::_TouchPosition[touchId].y = y; Leadwerks3D::Event(EVENT_TOUCH_MOVE,NULL,touchId,x,y).Emit(); //Leadwerks3D::Print("Move! "+Leadwerks3D::String(x)+", "+Leadwerks3D::String(y)); } }
I will upload the fix now.
-
Working off of this code now:
http://stackoverflow.com/questions/14201130/how-does-the-ontouch-event-behave
It appears that touch indexes are not persistent. In other words, when touch index zero is lifted, the touches "shift" to the left, and touch index 1 becomes touch index 0.
Motion events always indicate touch index 0, so I tried looping through from 0 to event.getPointerCount(), but I get a crash on getEventX():
for (int i = 0; i < event.getPointerCount(); i++) { Log.i("touchtest", "begin_move "); pointerIndex=event.getPointerId(i); x = event.getX(pointerIndex); y = event.getY(pointerIndex); Log.i("touchtest", "action_move " + pointerIndex.toString() + "(" + x + "," + y + ")"); androidRenderer.move(x, y, pointerIndex); }
-
I have beta testers.
- 1
-
Define "work"? An executable needs to be built for the editor to have something to launch, but you can load the project and start working with it as soon as it's created.
-
You should be able to switch between multiple projects:
http://www.leadwerks.com/werkspace/page/documentation/_/user-guide/project-manager-r679
-
I also suspect having better prizes actually decreased participation. People see the prizes and think too many other people will be trying to win, so they don't bother. And it could make the process less fun if you are trying to "get" something:
http://timtopham.com/piano-teaching/why-extrinsic-rewards-are-so-bad-for-motivation/
- 1
-
You the man!
-
OpenGL 4 support is needed for tessellation shaders and MSAA. Fortunately, good hardware is cheap:
I'm talking to the Mesa guys now. The Intel graphics chips on Windows actually run quite well, to my surprise.
- 1
-
A few of those items in your list will be supported in 3.1 right away. Almost everything there will be supported in 2014. I don't have exact release dates for each item, but that's the direction we're moving in.
We did have a self-shadowing parallax shader in Leadwerks 2. Tessellation makes self-shadowing bumpmaps obsolete, because it actually creates geometry on the surface that self-shadows using the real lighting system. (Texture-based lighting like you describe typically just uses a single input vector for a directional shadow.)
- 2
-
I have not been able to test it, but the problem is reportedly fixed on Julio's end:
http://newtondynamics.com/forum/viewtopic.php?f=9&t=7876&p=53933#p53933
-
Well, it looks like TJHeldna is the only participant, so he wins all the prizes:
http://www.leadwerks.com/werkspace/files/file/461-cold-feet-machine-for-penguins-demo-game/
I'm disappointed there was so little participation. On the other hand, I really like "Cold Feet" and I think it's the most polished looking demo we've gotten from these tournaments so far. The developer did a really nice job of blending in three themes: Linux, Halloween, and machinery. I hope we can get this game running on Linux soon.
- 1
-
This is built into the Leadwerks 3 editor. Right-click on a model in the Asset Browser, then select the Generate Shape > Polymesh or Convex Hull menu item to save a physics shape from the model.
The Leadwerks 3 physics shape format is not the same as the Leadwerks 2 format. (The Leadwerks 2 format is Newton serialized data, while the Leadwerks 3 format is our own and will not change.)
-
If the Entity::component member is NULL, no script is attached. This is not part of the official documented API and could change in the future.
- 1
-
Yes, I think that's the default behavior. I never saw a big difference from those though.
-
We're nearly there. I've got the editor compiling (but not linking) now. This part will either go really quickly or be really problematic.
-
The VIsual Studio compiler tends to be very slow compared to GCC and LLVM, but you might have other settings or something that slow it down. UAC or antivirus programs could be the cause, possibly. You might get better results if you delete the .suo file. The whole question is rather mysterious, but it's not uncommon.
-
Sorry, you should include files from App.h, in the "Source" directory, to include all your includes from. Main.cpp varies depending on platform. Android uses a special version of it, so App.h is the one to use.
-
Ah, you are one of the backers. It's good that you have an account already because I can just enable it when 3.1 is ready. I just finished the light quality and MSAA settings, and it's entering beta next week, as scheduled.
- 1
Multiple gravity sources
in Programming
Posted
Magnitude = length.
The min function is a C++ built-in thing. I think in Lua there is math.min or you can just call the Leadwerks command Math::Min().