Richard C

  • Content Count

  • Joined

  • Last visited

  • Days Won


Richard C last won the day on January 15 2017

Richard C had the most liked content!

About Richard C

  • Rank
    Advanced Member

Profile Information

  • Location
    Oxford, England

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I am using CreatandStartAnimation to change the diffuse colour of an object (created in Blender). It works as it should, but it appears the change isn't permanent. If I console.log the diffuse color of the object before and then after the animation the object's diffusecolor is the same. Am I right ? Thanks Richard C ***** I was not thinking it through The post animation console.log was running before the animation had finished ! Console.log within a Timeout function ensured the log run after the animation. The answer to my question is that an animation does change the diffuseColour of an object !!
  2. brianzinn - your suggested solution set me off on the right road and I now have the sub doing what I need. Many thanks to you and Wingnut R
  3. brianzinn and Wingnut Thanks both - playing with both - I'll let you know Cheers
  4. Hi Wingnut Yes in real-life the sub does allow for powered ascent/descent by use of vertical thrusters BUT these are not used to 'go faster' but to control ascent rate in the main - the sub always has positive bouyancy and without pilot intervention, would float to the surface. Reducing water pressure as the sub ascends causes air to expand which in turn creates even more bouyancy and the sub 'rushes' to the surface way beyond safe diving limits. As a point of interest - we actually allowed the sub to actually do that. The pilot got out of the sub at 15m and just let it ascend of in own accord. The sub actually left the water completely at the surface - a Red October moment for sure . The 900kg sub shot above the water by some 300cm. If that were allowed to happen in real life the passengers would be the whale fodder cos they would be dead as a result of extreme decompression sickness - the lungs could literally blow out of the body. So the vertical thrusters are used to control the rate of descent. For the same reason. they are used to maintain a fixed depth whilst moving horizontally when submerged. The purpose for the ease-in / easeout functions are two fold : 1. mimick what the pilot strives to do to make a slow start and gradually move to operating speed 2. to mimick the effect of the water / currents As I said earlier - the EaseIn formula works well - I just need the negative of it and I can't wrap my head round the solution Regarding sensors etc - I am raycasting to get the waterdepth in every render loop so know what depth the sub is at both from the surface and the seabed. The EaseOut function starts at a 1.5m from surface or bottom. Cheers Richard
  5. Still on my submarine project .............................. I need to use easing to make diving through water more realistic. Dive commences with a slow start easing to a constant descent/ascent rate. This is acheived with the formula used on each renderloop (the equivalent of EaseIn) : incrementer += 0.01; diveRate += Math.pow(1, incrementer); submarine.position.y -= parseFloat(diveRate / 2500); This works fine. However I'm struggling to acheive the equivalent EaseOut formula to apply to the vessel before it "hits" the sea bed on the descent or "bursts" through the water at the surface on ascent. Easing using Babylon animation or the likes of Greensock is not an option as the user needs to interact with other 'features' whilst the dive is underway. I realise this is a 'maths' problem' not a babylon issue but if some one has an answer or could point me to a good tutorial I would appreciate it thanks as ever Richard C
  6. @Wingnut - That's the one my friend. An alternative I have just been playing with is based on what Deltkosh said........ I know the position of the parent box on collision. The emitters are always the same distance/position away from the empty and therefore I could reposition the child relative to the empty and then emit. But getAbsolutePosition is much easier and less code and works. Problem solved. Thanks again both. PS How do I mark/tag this topic as solved?
  7. I have tried various ways similar to your suggestion. The 'from verts' is giving me the 'shape I want my only real issue is getting the positions of the verts onCollide after the moveWithCollisions. So really there is only one Q to answer - how do I establish the actual position of the child mesh so that I can get to the verts. Thanks
  8. @Wingnut Thanks pal. That is the very PG I used to learn particle emission from vertices! 2 things ........ the bottom of the sub is not rectangular.square so the verts are not linear. Additionally, the children are not a plane but need to be an arc to get the correct sand cloud shape. If you picture such an event you will remember that sand 'kicked' up is far more of a cloud than square/rectangle/linear. All would be well if I could establish the position of each child at the point of collision. The seabed isn't flat of course- so the depth varies along the sub's path. It seems that moveWithCollision is displaying as it should but not updating the actually position of each child/mesh. It will be helpful to see what you come up with if you get the chance. Thanks
  9. @Deltakosh I am not updating the geometry per se. I am still on the same project as I have been in the recent opsts. I have a model submarine that dives from the surface to the seabed and the particles are to simulate the sand 'cloud' that is kicked up when the sub lands on the seabed. The sub dives and using moveWithCollisions to detect when the sub hits the seabed. Thanks
  10. Hi again I have a box being used as an Empty with 4 children. I am using moveWithCollisions on all 4 using the box mesh as the collider. When collided with the ground I have particles emitted from the vertices of each child mesh. All works well EXCEPT the particles are emitted from the children's original starting position rather than the point of collision where I want them to emit. I assumed getVerticesData(BABYLON.VertexBuffer.PositionKind) followed by .updateVerticesData(BABYLON.VertexBuffer.PositionKind),would establish the new position of each mesh but it doesn't. So my question is....... How to establish the new position of each child and therefore the vertices positions of each. Thanks RichardC
  11. @jerome @SvenFrankson @adam @Wingnut Thanks all. adam - your suggestion works for my project, so problem solved. I now have a working depth sounder. Right, on to the next challenge ! Cheers
  12. @adam @Wingnut Thanks Adam and Wingnut (hope things are good with you too). I am continuing to play but could I ask you or anyone else the answer to the my original question ............ 1. It seems to me that the ray should be intersecting with the actual mesh rather than the bounding box. Is this possible? I vaguely remember reading somewhere of there being a .getboundingMesh - does it exist or is it just wishful. Wingnut - I'm not sure using a heightmap for the seabed will be a workaround - I have modelled quite a few 3d coral reef objects that will of course build off the sea bed. I am thinking the seabed could be split into sections each according to height. I can then raycast from the bounding boxes from each of there together with the same for each coral reef. It would still be good to know if there is something like a bounding mesh. Adam, I assume you are suggesting I try making the 'seabed' a ribbon, albeit a static one. If a seabed were to move as much as the sine wave makes the ribbon in that PG I think we would have a Tsunami Cheers Ricard
  13. @Deltakosh I'm not sure how this will work. I assume scene.pick is for mouse use. I assumed I should be using a ray, fired on each frame from the vector.y of the water's surface where the vessel is to the seabed. How can scene.pick work in that senario please? Thanks Richard C
  14. My project is ocean based. I want to measure the water depth as a vessel travels the water surface. The seabed is undulating, so I would expect the point at which the ray intersects the 'seabed' mesh to change as the vessel moves through the water. I understand the ray interacts with the bounding box of the mesh it is intersecting. My problem appears to be that the bounding box of the seabed is effectively a rectangle and currently as the vessel moves the water depth is remaining constant. My code (pinched from examples in the PG) is : var ray = new BABYLON.Ray(new BABYLON.Vector3(0, nSeaBed.getBoundingInfo().boundingBox.maximumWorld.y, 0), new BABYLON.Vector3(0, -1, 0)); var worldInverse = new BABYLON.Matrix(); nSeaBed.getWorldMatrix().invertToRef(worldInverse); ray = BABYLON.Ray.Transform(ray, worldInverse); var pickInfoW = nSeaBed.intersects(ray); waterDepth = (pickInfoW.pickedPoint.y); 1. It seems to me that the ray should be intersecting with the actual mesh rather than the bounding box. Is this possible? 2. Also. I have to admit I don't understand the code - would someone be kind enough to comment each line to briefly explain what the code is doing, particularly 'invertToRef'. Thanks Richard C
  15. @Deltakosh I've been trying the update function but run into problem. How do you measure the distance between particle and the axis from which it is emitted. It is not right to measure from the emitter. For your info - I am trying to simulate a submersible descending to the seabed and the subsequent 'sand cloud' that would result. I current have 4 emitters (as you can see in the PG) in each corner of the sub. Thanks