Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - gamerfan

#1
Support / crosshair and weapon
March 31, 2012, 11:57:46 AM
Hi,
I have added a cross hair  as object3d and attached to weapon model.But the problem is that the cross hair is not visible.I am just following the Car tutorial where how the wheels of the Car are attached so that when the car moves the automatically the wheels also also move.I did it the same way here as well.But it does not seem to be working.But when I add the crosshair to weapon like below,

weapon.addChild(crossHair);

cross hair is not visible.Any clues what I am doing wrong here.

Thanks in advance.
#2
Support / Re: .Md3 support
March 11, 2012, 08:35:48 AM
That also can be developed like this!!! :) Any volunteers?
#3
Support / Re: .Md3 support
March 11, 2012, 06:37:25 AM
@zammbi, there is a project in google code that deals with this.
http://code.google.com/p/q3m4jpct/
#4
Support / .Md3 support
March 10, 2012, 10:04:01 AM
I know that already JPCT does not support .MD3. But is there any support for this in future versions?
#5
Support / Re: fire explosion effect
February 13, 2012, 11:06:28 AM
Quote
Cool, I just made an explosive effect for my game yesterday. :)
To anwer your second question. Search your code for "setAdditionalColor()". I suppose, that you are filling your particle with an extra color.
Sorry I am not using any additionalColor() here. What I am doing is attaching muzzle flash jpg to plane object.That is it.In fact my current code is not all using any particle system nor above method.
Also curious to know how did you do that.  :D
#6
Support / Re: fire explosion effect
February 07, 2012, 12:21:21 PM
I was able to do some mock up kind of thing: this is what I have done.I took a muzzle flash texture from net.

In the Car example, I loaded a plane and added this texture to it.Then in the processProjectile() method, just used like a on-off kind of switch.This will however produce gun firing effect.But not perfect.Also, have not tried it with my actual code.

Loading muzzle flash:


private void loadMuzzleFlashObject(){
   muzzle = Primitives.getPlane(1,4);
   muzzle.translate(new SimpleVector(0, 10, 0));
   muzzle.scale(10);
   Texture muzzleTexture = new Texture("textures" + File.separatorChar + "MuzzleFlash.jpg");
   texMan.addTexture("muzzleflash", muzzleTexture);
   muzzle.setTexture("muzzleflash");
   muzzle.build();
   theWorld.addObject(muzzle);
   muzzle.setVisibility(false);
}

Displaying muzzle flash:


private void displayMuzzleFlash(){
   if(muzzle.getVisibility())
      muzzle.setVisibility(false);
     else
      muzzle.setVisibility(true);   
}

This method is called from the processProjectile() method.Now the issues I am facing are :
1. The image is a .jpg so it will not have transparancy.This is can be rectified.
2. The color of the actual .jpg is yellow.But when I added along with the car example, the color of the texture is changed to violet, ie it is taking the color of the Car.I am not able to figure out why this is happening.I have not manually instructed to change the color to violet.

#7
Support / Re: fire explosion effect
February 07, 2012, 09:41:55 AM
Quote
It might be better to change the texture coordinates instead of the texture itself, but for a simple plane, either way will do. That's the same thing the explosion effect in Robombs works btw.
In that, if I am correctly understood the code, are you changing one texture cordinates? That is where I think the code was not able to integrate.However let me try this logic.For that, how can I change different textures to a plane?
#8
Support / Re: fire explosion effect
February 07, 2012, 06:57:41 AM
I got one logic to do this.I saw this technique from other sites.They are having textures for muzzle flash.They just keep changing the textures at different interval. I am thinking to use this tehnique here.For that, use a plane and apply a default texture to it and when the user presses the fire key, changes the textures at a regular interval.Please correct me if I am wrong.
#9
Support / Re: fire explosion effect
January 13, 2012, 07:38:46 AM
sorry for the late reply.  Actually I want to use some muzzle flash when gun is fired.But now thinking to use some models instead.searching in googles.
#10
Support / Re: fire explosion effect
December 07, 2011, 05:37:59 AM
Sorry Egon, I had not changed the code initially. I just ported into my application. But what happened was that when I integrated it first time, the expplosion image was already started appearing on the screen, but no explosion effect takes placeat all.So I anaylized the code and found the place where explosion object was prepared.There I made the change to suite to my requirements. Moreover, I need to show this explosion when user press some key.That is why I made this change and when really user presses a key, I set the explosion object set it back to true.But if I change it to Ticker.getTime(), actually the explosion effect does not happen at all. Only some static weired image appears on the screen.Will this work only with your code? If that is the case, what are the other things I need to take into considerations to integrate with my code ? Thanks for your time.
#11
Support / Re: fire explosion effect
December 06, 2011, 06:13:32 PM
I initialized Ticker in Explosion.java and changed to Ticker.getTicks(). So the effect is somewhat looks good. But the explosion does not remove after the effect.The problem here is that if cTicks greater than maxTicks, the explosion is not visible.So what is the use of this if block?
#12
Support / Re: paradroidz demo
December 06, 2011, 05:37:49 PM
it is just used for demo purpose only, right? So what is the issue here? If we get the copyright for using the materials, I do not think it is a legal issue.However I request any forum members who is having the source code, please send it to me.It is only for educational purpose.
#13
Support / paradroidz demo
December 06, 2011, 12:12:45 PM
I happened to see lot of references to paradroidz 3d demo developed in jpct.But I could not download it not found in demos.Can anyone upload this? Thanks in advance
#14
Quick update.Egon, I have used my texture for testing particle.It is working.But it does not provide me the exact feeling of an 'Explosion', though it is emitting so many particles.I updated the size of the triangle.But still not working.I want this one to be used for my fire explosion.What are the parameters I need to modify here so as to make a complete explosion effect?
#15
Support / Re: fire explosion effect
December 05, 2011, 06:38:44 PM
I have ported your 'explosion' code to JPCT SE, not tAndroid.
This is how I am getting cTicks and maxTicks.

public boolean process(long ticks) {
            setVisibility(true);
cTicks = Ticker.getTime() - start;
if (cTicks < 0) {
cTicks = maxTicks;
}



maxTicks = maxLength * 15;

where maxLength = 8.
Please find my version of Explosion.java. I have added blueprint.complile() as per your suggestion.But the entire screen is getting darker and no explosion is actually happening, only static  scattered images displayed on the screen .


public class Explosion extends Object3D{

static final private long serialVersionUID = 1L;

private static Object3D blueprint = null;
private static final int MAX_PER_SIDE = 4;//Globals.enhancedGraphics ? 8 : 4;

static {
                TextureManager.getInstance().addTexture("explosion", new Texture("textures"+File.separatorChar+"explosion.png"));
blueprint = Primitives.getPlane(1, 10);
blueprint.translate(100000, 100000, 100000);
blueprint.setTexture("explosion");
blueprint.setBillboarding(true);
blueprint.setTransparency(11);
blueprint.setTransparencyMode(Object3D.TRANSPARENCY_MODE_ADD);
blueprint.setAdditionalColor(java.awt.Color.WHITE);
blueprint.getMesh().compress();
                blueprint.compile();
blueprint.build();
}

private Object3D[] blow = new Object3D[MAX_PER_SIDE * 4];
private int[] index = new int[MAX_PER_SIDE * 4];
private int mainIndex = 0;
private long cTicks = 0;
private int maxLength = 20;
private long maxTicks = 1000;
private long start = 0;
private int blows = 3;

private float maxXP = 1000;
private float maxXM = 1000;
private float maxZP = 1000;
private float maxZM = 1000;

private boolean isLocal = false;

public Explosion() {
super(blueprint, true);
setScale(3);
setTransparency(13);
for (int i = 0; i < blow.length; i++) {
    blow[i] = new Object3D(blueprint);
}
}

public void addToWorld(World world) {
world.addObject(this);
for (int i = 0; i < blow.length; i++) {
                       blow[i].setVisibility(false);
world.addObject(blow[i]);
}
setCollisionMode(Object3D.COLLISION_CHECK_SELF);
}

public void remove(World world) {
world.removeObject(this);
for (int i = 0; i < blow.length; i++) {
world.removeObject(blow[i]);
}
setCollisionMode(Object3D.COLLISION_CHECK_NONE);
}

public void enable(SimpleVector startPos) {
                System.out.println("....inside enable meth......");
getTranslationMatrix().setIdentity();
translate(startPos);
setTexture(this, 0);
mainIndex = 0;
setVisibility(false);
maxLength = 8;//bomb.getBackAnimationSpeed();
blows = Math.min((int) (maxLength / 7.5f + 0.5f), MAX_PER_SIDE);
maxTicks = maxLength * 15;//LocalBombManager.DURATION_MUL;
                int ff = blows << 2;
                System.out.println("1....blw size "+"blows:"+blows+" "+ff);
for (int i = 0; i < blows << 2; i++) {
                        System.out.println("XXXXXX");
blow[i].getTranslationMatrix().setIdentity();
blow[i].translate(startPos);
setTexture(blow[i], 0);
index[i] = 0;
blow[i].setVisibility(true);
}
cTicks = 0;
start = Ticker.getTime();
}

public void disable() {
this.setVisibility(false);
for (int i = 0; i < blow.length; i++) {
blow[i].setVisibility(false);
}
}



public boolean process(long ticks) {
            setVisibility(true);
cTicks = Ticker.getTime() - start;
if (cTicks < 0) {
cTicks = maxTicks;
}
mainIndex = Math.min(31, (32 * (int) cTicks / (int) maxTicks));
setTexture(this, mainIndex);

float xp = 1;
float xm = 1;
float zp = 1;
float zm = 1;

float div = ((float) maxLength * (float) cTicks / (float) maxTicks) / (float) blows;
float indDiv = Math.min(31, ((float) 32 * (float) cTicks / (float) maxTicks) / (float) blows);

float blastRadius = 3;
SimpleVector ellips = new SimpleVector(blastRadius, blastRadius, blastRadius);
float range = (float) blows * div;

// xp
float mt = Math.min(maxXP, range);
SimpleVector trans = new SimpleVector(mt, 0, 0);
SimpleVector xpm = checkForCollisionEllipsoid(trans, ellips, 1);
if (xpm.equals(trans)) {
maxXP = 1000;
} else {
maxXP = mt;
}

// xm
mt = Math.min(maxXM, range);
trans = new SimpleVector(-mt, 0, 0);
xpm = checkForCollisionEllipsoid(trans, ellips, 1);
if (xpm.equals(trans)) {
maxXM = 1000;
} else {
maxXM = mt;
}

// zp
mt = Math.min(maxZP, range);
trans = new SimpleVector(0, 0, mt);
xpm = checkForCollisionEllipsoid(trans, ellips, 1);
if (xpm.equals(trans)) {
maxZP = 1000;
} else {
maxZP = mt;
}

// zm
mt = Math.min(maxZM, range);
trans = new SimpleVector(0, 0, -mt);
xpm = checkForCollisionEllipsoid(trans, ellips, 1);
if (xpm.equals(trans)) {
maxZM = 1000;
} else {
maxZM = mt;
}
for (int i = 0; i < blows << 2; i++) {
                       System.out.println("RRRRRRR");
blow[i].getTranslationMatrix().setIdentity();
blow[i].translate(getTranslation());
                        blow[i].setVisibility(true);

int p = i % 4;
if (p == 0) {
// xp
blow[i].translate(Math.min(maxXP, div * xp), 0, 0);
setTexture(blow[i], (int) Math.min(31, (blows + 1 - xp) * indDiv));
xp++;
}
if (p == 1) {
// xm
blow[i].translate(-Math.min(maxXM, div * xm), 0, 0);
setTexture(blow[i], (int) Math.min(31, (blows + 1 - xm) * indDiv));
xm++;
}
if (p == 2) {
// zp
blow[i].translate(0, 0, Math.min(maxZP, div * zp));
setTexture(blow[i], (int) Math.min(31, (blows + 1 - zp) * indDiv));
zp++;
}
if (p == 3) {
// zm
blow[i].translate(0, 0, -Math.min(maxZM, div * zm));
setTexture(blow[i], (int) Math.min(31, (blows + 1 - zm) * indDiv));
zm++;
}
}
System.out.println("sssssss");
       
if (cTicks > maxTicks) {
                    //  setVisibility(false);
//disable();
return true;
}
               
return false;
}

private void setTexture(Object3D obj, int index) {

if (index > 15) {
index = 15 + (16 - index);
}

int v = (index / 4) * 64;
int u = (index % 4) * 64;

PolygonManager pm = obj.getPolygonManager();
int tid = pm.getPolygonTexture(0);
Texture t = TextureManager.getInstance().getTextureByID(tid);
float u1 = (float) u / (float) t.getWidth();
float v1 = (float) v / (float) t.getHeight();
float u2 = (float) (u + 64) / (float) t.getWidth();
float v2 = (float) (v + 64) / (float) t.getHeight();
TextureInfo ti = new TextureInfo(tid, u1, v1, u1, v2, u2, v1);
pm.setPolygonTexture(0, ti);
ti = new TextureInfo(tid, u1, v2, u2, v2, u2, v1);
pm.setPolygonTexture(1, ti);
obj.recreateTextureCoords();
}
}