### 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.

### Messages - raft

Pages: 1 ... 130 131 [132]
1966
##### Support / camera basics
« on: February 26, 2005, 02:01:42 pm »
here it is. one must reset rotation matrix after rotating mesh, without it the result is as rotating it twice

Code: [Select]
`        map = Primitives.getPlane(6, 100);map.rotateX((float)(Math.PI / 2f));map.rotateMesh();map.setRotationMatrix(new Matrix());`

all is well now, both appereance and collision radius. men, it is really a great library !

Code: [Select]
`r a f t`damn it ! i almost gone mad

1967
##### Support / camera basics
« on: February 25, 2005, 09:34:30 pm »
still unclear

in our case direction is (0, -1, 0)  (upwards) and move speed is negative resulting in moving downwards.

this was the code piece creating and rotating the plane to make it an xz plane (to which you can approach up to ellipsoid.z)
Code: [Select]
`        map = Primitives.getPlane(6, 100);map.rotateX((float)(Math.PI / 2f));`

as you suggested i added a rotate mesh:
Code: [Select]
`        map = Primitives.getPlane(6, 100);map.rotateX((float)(Math.PI / 2f));map.rotateMesh();`

very strange, it resulted in a xy plane facing -z (can be seen best when camera direction is 0, 0, -1) and can be approached upto to ellipsoid.z (collision radius is correct in this case)  it behaved like i made a rotateY(pi) :?: :?:

what s up ?
Code: [Select]
`r a f t`
damn ! i was almost good at linear algebra

1968
##### Support / camera basics
« on: February 25, 2005, 04:27:02 pm »
hi,

i am moving camera in a simple world (an xz plane at origin) with

Code: [Select]
`SimpleVector normalizedDirection = direction.normalize();world.checkCameraCollisionEllipsoid(normalizedDirection, COLLISION_ELLIPSOID, moveSpeed, RECURSE_DEPTH);`
when i move camera down (+y) i expected it go down to COLLISION_ELLIPSOID.y but this is not the case. independent of ellipsoid.y it moves to ellipsoid.z + a small amount depending on move speed.

couldnt get why ?

Code: [Select]
`r a f t`
RECURSE_DEPTH : 5
moveSpeed : 2 - 10

1969
##### Support / Animation
« on: February 23, 2005, 08:31:33 pm »
hi,

i tried a similar approach. first animated my object in 3d max than exported each keyframe to a different file.

however it didnt work me. jpct complained about mismatch of mesh sizes of the initial object and keyframes. it seems as max exports objects with different mesh sizes (possibly making an optimization)

how can i handle this ? (sorry, :oops: it is a how to use max question)
and does anyone know a good md2 editor ?

Code: [Select]
`r a f t`

1970
##### Feedback / kind of brain storming
« on: February 17, 2005, 11:56:37 pm »
hi rolz,

it is so basic that impossible to object your suggestion. however i had already implemented the node and move mechanism mentioned above. and a couple of things more depending on nodes.

so i am looking for a way to fit graphics into it. with minimum amount of change if possible

Code: [Select]
`r a f t`

1971
##### Feedback / kind of brain storming
« on: February 17, 2005, 05:55:14 am »
i have a two roomed world (each an object3d) with a door or tunnel combining the two rooms. i created an octree from each, assigned the octree to room and turned on collision detection for octree.

i assumed while going through the door a collision will be detected. but it didnt. why ? or doesnt it work that way ? if there isnt a polygon there, you cannot collide it.

if so, how can i implement such a door mechanism. i want to be notified when something passes there but i dont want that something changes its movement.

can i disable camera/object sliding in case of a collision ? in both ways: it shouldnt slide but stop and it will go into collision target.

Code: [Select]
`r a f t`

1972
##### Projects / tokima
« on: February 17, 2005, 03:53:45 am »
Quote from: "EgonOlsen"
As a rule of thumb: Never let any other thread than the main-thread (the thread that does the rendering) modify the camera or some object's matrices. Not the timer-thread and not an Event-Listener-thread (like a Key- or Mouse-Listener) because you may run into trouble. And it's a real pain to debug this stuff...believe me... :wink:

it is quite true that debugging a multi-threaded application is a real pain. however using timers greatly eases some tasks.

you may consider using javax.swing.Timer instead of java.util.Timer since the former is executed in awt's event dispatching thread. assuming your rendering is done in paint or paintComponent methods you end up with a thread-safe timer mechanism.

Quote
r a f t

1973
##### Feedback / kind of brain storming
« on: February 17, 2005, 01:37:28 am »
no, stupid enough i didnt have a look at projects page at forum. only at jpct home page

there seems to be a hidden treasure there
Code: [Select]
`r a f t`

1974
##### Feedback / kind of brain storming
« on: February 16, 2005, 01:52:27 am »
hi,

as a dreamer i am trying to develop a chat system in which you may move around. maybe kind of virtual reality system at very very later phases..

well, after toying with jpct and with helge's valuable helps i am not that far from moving in a 3d world and animating characters according to their state. (walking, dancing etc)

here is what i have: a world description with node groups and nodes as leafs. users and world entities (items etc) can only exist in a node. i assumed nodes as parts (mostly rooms) of a building and node groups as buildings.

to minimize network traffic and hence to increase speed, clients are loaded with users' starting node group and its current state (user positions etc). any movement from node to node (in same group) generates a user moved event to user and a one moved event to users of that node group. moving among node groups requires loading of new group and state. (just like switching levels in an fps)

the mechanism is grounded on this: part of world is serialized to client at the beginning and it is reconstructed identical to server's one at client side as need arrives. (moves at node group or jump from group to group)

i planned all that with the idea of no real time graphics: with at most a static image of the node user is in.

now with a desire to fit graphics to it, i am looking for the best way to integrate it with jpct.

one idea is to map karga's nodes to a jpct world and make no change in karga's node definition. genarate 'user moved in node' events and send them to users of that node.

or use octree nodes or portal sectors mapped to karga nodes (this seems harder to implement. by the way, is there any way to define portals in 3dmax, without the need to define portals externally with exact coordinates ?) of course genarate 'user moved in node' events is necessary again.

or is there a way to define nodes as floating but not static. (position in 3d space with a radius etc.) and still generate user moved events ?

another main problem is either to make it fps like (camera at user's eye) or not (camera around user. adjusting itself's position according to user's position in the current scene)

this way or other it comes to problem of network speed and latency. like fps, we need to broadcast every keystroke of user (maybe some optimization is possible) to clients. with outer camera (movement with mouse clicks to destination) it can be implemented with sending only destination point. (say you are moving from one side to other side of a room, like fps it requires lots of movement events (key strokes) to be broadcasted, with outer camera only one event: destination point). does anyone imagine any user friendly way to move with mouse clicks while looking from user's eyes ?

trying to look rationally it seems to chose outer camera and movement with mouse clicks as far more reasonable. but i really wanna it like to be a first person shooter. i am asking myself contsantly, which is the point of optimal trade off ?

well thats are the main questions to answer before going any further. i am open to and in fact looking for any smart and/or efficient ideas.

Code: [Select]
`r a f t`
maybe it's best to try both and see what   :?:

1975
##### Support / visible sides
« on: February 09, 2005, 07:54:53 pm »
here is the answer (self service :idea: )

by default Config.maxPolysVisible is 4096 which does not allow any additional polies to be drawn

Code: [Select]
`r a f t`

1976
##### Support / visible sides
« on: February 09, 2005, 06:23:44 pm »
hi all,

first of all i must mention jpct really seems great

i am just a newbea at computer graphics and toying with it to grasp the basics.

i loaded a 3ds model and rotate the camera around it. for a model with one or two objects it is all-well. but with three, four or more objects, i couldnt manage to draw them properly. they are either not drawn or drawn half like the camera at completely different point.

first i suspected if 3dmax exporting fails. i retried it one object in 3ds file and cloning object or by reloading the file. still couldnt manage it.

stranger enough world.getVisibilityList().getSize() seems to remain constant at 4097.

what may be wrong ? below is the complete source. you may try it with any 3ds file.

Code: [Select]
`import java.io.*;import java.awt.*;import java.awt.event.*;import javax.swing.*;import com.threed.jpct.*;public class Test1 { private final static SimpleVector STARTING_POS = new SimpleVector(0, 2, -150); private final static SimpleVector CAMERA_TARGET = new SimpleVector(0, 1, 0); private World world; private FrameBuffer buffer; private RenderPanel panel; private Timer timer; private Test1(String[] args) throws Exception { String fileName = args[0]; float scale = args.length >= 2 ? Float.parseFloat(args[1]) : 1f; int period = args.length >= 3 ? Integer.parseInt(args[2]) : 100; int copies = args.length >= 4 ? Integer.parseInt(args[3]) : 3; world = new World(); for (int i = 0; i < copies; i++) { FileInputStream fis = new FileInputStream(args[0]); Object3D[] os = Loader.load3DS(fis, scale); System.out.println("loaded objects size: " + os.length + " scale: " + scale); for (int oIndex = 0; oIndex < os.length; oIndex++) { Object3D o = os[oIndex]; o.rotateX((float) (Math.PI / -2f)); // since 3dmax coordinate system differ o.translate(new SimpleVector(20 * i, 20 * i, 20 * i)); // move this world.addObject(o); System.out.println("added object " + o.getName()); } } world.buildAllObjects(); Camera camera = world.getCamera();      camera.setPosition(STARTING_POS); camera.lookAt(CAMERA_TARGET); buffer = new FrameBuffer(600, 400, FrameBuffer.SAMPLINGMODE_NORMAL); JFrame frame = new JFrame("testing jpct"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel = new RenderPanel(); panel.setPreferredSize(new Dimension(600, 400)); panel.addMouseListener(new MouseAdapter(){ public void mouseClicked(MouseEvent e) { if (timer.isRunning()) timer.stop(); else timer.start(); } }); frame.add(panel); timer = new Timer(period, new ActionListener(){ // no need to synchronize this stuff since paint and this is both called in awt's thread public void actionPerformed(java.awt.event.ActionEvent e) { Camera camera = world.getCamera(); SimpleVector v = camera.getPosition(); v.rotateY((float) (Math.PI / 20)); camera.setPosition(v); camera.lookAt(CAMERA_TARGET); panel.repaint(); } }); timer.start(); frame.pack(); frame.setVisible(true); System.out.println("started"); } class RenderPanel extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.ORANGE); buffer.clear(); world.renderScene(buffer); //world.draw(buffer); world.drawWireframe(buffer, Color.ORANGE); g.drawImage(buffer.getOutputBuffer(), 0, 0, null);                  g.drawString("running..", 10, 15); g.drawString("visible size: " + world.getVisibilityList().getSize(), 10, 30); g.drawString("camera: " + world.getCamera().getPosition(), 10, 45); } } public static void main(String[] args) throws Exception { System.out.println("usage: test1 <3ds file> [scale] [update period im ms] [# copies]"); Test1 test1 = new Test1(args); }} `

r a f t

Pages: 1 ... 130 131 [132]