Showing posts with label mobile device. Show all posts
Showing posts with label mobile device. Show all posts

Friday, August 23, 2013

Blender 3d Gamekit Touch Move Android Tutorial


Following last tutorial, background moving, as moving direction is wrong, we need to fix it first.
1. Rotate camera and change motion direction in game logic editor.
2. Adjust plane shape.
3. Cut seam line on the plane model. And generate uv map.
4. Export uv map as image file.
5. Open uv map in gimp2 to paint the texture.
6. Save image and load into Blender
7. Apply texture to plane. And verify in 3d view.
8. Creat txt file. Name it OnInit.lua and put some global variables/parameters. So later on if we want to change something globally, we can easily find them. This script will be called automatically when game starts.

--Global variable
    --set touch move parameters
    Sensitivity = 0.005
    --invert = -1 -> is inverted
    Invert = 1


    Threshold=3.5

9. Create txt file called planeTouchMove.lua and put following code......
mouse=OgreKit.Mouse()
scene = OgreKit.getActiveScene()
play = scene:getObject("plane")
mouse:capture()

--display mouse movement for debug
--dPrintf("---xrel: " .. mouse.xrel)
--dPrintf("---yrel: " .. mouse.yrel)
--dPrintf("---xrel + yrel: " .. mouse.xrel+mouse.yrel)

--using threshold to filter out unwanted small touch movement
if ((mouse.xrel>Threshold or mouse.xrel<-Threshold)or(mouse.yrel>Threshold or mouse.yrel<-Threshold)) then
      play:translate(-(mouse.yrel) * Sensitivity * Invert,-(mouse.xrel) * Sensitivity * Invert,0)
      dPrintf("---xrel: " .. mouse.xrel)
      dPrintf("---yrel: " .. mouse.yrel)
else
     dPrintf("no movement")
     


end


What does this do is measuring mouse movement. And pass it to the plane. It uses sensitivity and invert variables defined in the onInit.lua file to adjust the movement. And use threshold to filter out unwanted tiny figure movement.

10. Go to plane game logic and create sensor mouse + movement and click the positive pulse "..." button, it is the first to the left.

11. In game logic link sensor with lua script.
12. Pack content and save file.
13. Test on desktop.
14. Copy the blender file into android project asset folder.
15. Open eclipse and android Gamekit file.
16. Refresh asset folder and goto main.java to change file name to the one just copied.
17. Connect android device to desktop
18. In eclipse save and run.

blender file is available at:https://docs.google.com/file/d/0B2dWucciRgDPUmFOc19ibFNYNmc/edit?usp=sharing

Sunday, July 21, 2013

How to do Background Rolling On Mobile Device Using Blender & Gamekit

This demo showing how to create a rolling background as seen on arcade platform 2D/2.5D games using blender3D and gamekit. at the end test on a real android device Nexus 7.
Following are the Steps:
1. Create a 'mesh plane' rectangular as background
2. Move and Rotate Camera
3. Import pre-modelled Plane
4. Add shadeless material to background
5. Unwrap UV,1024 x 1024
6. export UV image
7. stitch background image on UV map in photoshop or gimp2
8. save the image
9. load image into texture under material
10. add game logic to camera and airplane
11. pack external data in file and save file
12. test on blender gamekit add-on using desktop
13. copy file into gamekit android package asset folder
14.open eclipse, change the file name reference in the main.java file
15. connect nexus 7 and run the test.

the blender file can be download at

Wednesday, June 19, 2013

ios 3D game Test on Simulator


  
ios game 'switch' using Blender 3D 2.6 and gamekit game engine
build iOS iPhone ipad game using free Blender 3D and GameKit,
Just a little programming knowledge required.

Game Engine iOS Build Tutorial


this video showing how to build blender 3d gamekit ( free game engine )iPhone ios application for running blender 3D game on iOS devices.
download cmake from cmake.org.in xcode project setting, change code signing to no, i missed that in the video.

The goal of gamekit is to create a basic game engine that allows fast prototyping build around open source software free for commercial use.

Using Ogre or Irrlicht for graphics, Bullet for physics, OpenAL for sound
OgreKit is most actively developed and in svn/trunk, the suspended Irrlicht version is in svn/branches/IrrKit.
Engine is written in C++ and the game logic can be done in C++, Lua scripting or logic bricks


Friday, September 28, 2012

Android openGL touch look testing on nexus 7



Blender 3D gamekit Android opengl touch look testing on nexus 7 
using Lua Script to build game logic






below is the lua script used in video:

Sensitivity = 0.005
Invert = 1
Threshold=6

--OgreKit.DebugPrint(Sensitivity)
mouse=OgreKit.Mouse()

scene = OgreKit.getActiveScene()
play = scene:getObject("Player")
sensor=scene:getObject("senMouseLook")

mouse:capture()
--dPrintf("---xrel: " .. mouse.xrel)
--dPrintf("---yrel: " .. mouse.yrel)
if mouse.xrel+mouse.yrel>Threshold or mouse.xrel+mouse.yrel<-Threshold then
    play:roll( -(mouse.xrel ) * Sensitivity * Invert,OgreKit.TS_LOCAL)
    play:pitch( -(mouse.yrel) * Sensitivity * Invert,OgreKit.TS_LOCAL)       
end