Forums

OverviewFelgo 2 Support (Qt 5) › Particle Error

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #19959

    L

    I’m just going through the first few tutorials for Vplay, and I’m having a problem with particles. The StackBox demo works fine, but even when I copy its code into my own experiment, the particle section throws up this error:

    “Could not open \qml\Vplay\particles\ParticleVplayInternal.qml for reading. Either the file does not exist or you do not have permissions to open it.”

    I already tried various permutations of where to put the .json and .png for the particle. Copying the demo arrangement, they’re in the entities folder which is in the qml folder. I also tried putting them in the assets folder, same error. Current qml file:

     

    import Felgo 3.0
    import QtQuick 2.0
    import "entities"
    
    GameWindow {
      id: gameWindow
    
      onSplashScreenFinished: world.running = true
    
        EntityManager {
            id: entityManager
            entityContainer: scene
        }
    
        Scene {
            id: scene
    
            PhysicsWorld {
                id: world
                running: false
                gravity.y: 9.81
                z: 10 // draw the debugDraw on top of the entities
    
                // these are performance settings to avoid boxes colliding too far together
                // set them as low as possible so it still looks good
                updatesPerSecondForPhysics: 60
                velocityIterations: 5
                positionIterations: 5
    
                // set this to true to see the debug draw of the physics system
                // this displays all bodies, joints and forces which is great for debugging
                debugDrawVisible: false
            }
    
            EntityBase {
                entityId: "ground1"
                entityType: "ground"
                height: 20
                width: scene.width
                anchors {
                    bottom: scene.bottom
                }
    
                Rectangle {
                    anchors.fill: parent
                    color: "white"
                }
    
                BoxCollider {
                    anchors.fill: parent
                    bodyType: Body.Static
                }
            }
    
            EntityBase {
                entityId: "box1"
                entityType: "box"
                x: scene.width/2
    
                Image {
                    id: boxImage
                    source: "../assets/box.png"
                    anchors.fill: boxCollider
                }
                BoxCollider {
                    id: boxCollider
                    width: 40
                    height: 40
                    anchors.centerIn: parent
    
                    fixture.onBeginContact: {
                        collisionSound.play();
                        collisionParticleEffect.start();
                    }
                }
                SoundEffectVPlay {
                    id: collisionSound
                    source: "...assets/test.wav"
                }
                ParticleVPlay {
                    id: collisionParticleEffect
                    fileName: "SmokeParticle.json"
                }
            }
        }
    }

    …and upon further inspection, the audio isn’t working either, but my main concern at the moment is the particle error.

     

    #19972

    Günther
    Felgo Team

    Hi,

    regarding sound: You specify “…assets/test.wav” as source. As the Main.qml lies in the qml folder of the project, the correct relative path would be “../assets/test.wav”. It is also recommended to specify asset paths with Qt.resolvedUrl(…):

    Qt.resolvedUrl("../assets/test.wav")

    You should specify the correct fileName path for SmokeParticle.json in the same manner. You current setup refers to the file qml/SmokeParticle.json of your project.

    As particles work for the StackTheBox demo, the issue probably lies in your custom project’s setup of assets and code.

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support