I loaded a .fbx object named "plane" into my content folder. I have an empty Actor on the scene with an Added C++ Scene Component. Using the C++ code, I'd like to access my .fbx object "Plane" and load it to the scene through CODE. Much like in unity ex:
Instantiate(Resources.Load(FILEPATH),new Vector3(x,y,z),new Quaternion());
You can't just place a fbx file into your level, you have to use an actor for that. Add a static mesh component to your actor and on this component set the mesh to your fbx asset.
You can not directly load stuff from files in C++, you have to use the names from imported assets. The whole point of this is that you can move files and assets around without your code breaking.
Related
Actually, I was trying to change the skeletal mesh of car in UE4, in the wheeled vehicle demo project which comes in ue4 c++ API.
Firstly I inherited blueprint from ue4 wheeled vehicle c++ class.
Then I opened blueprint editor and replaced default skeletal mesh to my skeletal mesh.
I assigned bone names correctly.
Then everything was in its place(according to me)
Then I recompiled.
Then I placed blueprint in level and possess it. But when I clicked W,A,S,D keys it doesn't work. And the car doesn't move at all.
If I am doing any mistake, please guide me through steps and how can I resolve it.
The animation blueprint is also tied to a specific Skeleton. If your new skeletal mesh uses a different skeleton than the one currently assigned to your skeletal mesh component, then you will need to create a new corresponding animation blueprint to use with it.
I'm searching for docs on cocos2dx website and on google but i couldn't find any. The problem is, when I load a csb file from cocostudio, it loads all the nodes and its resources etc... it makes the texture memory so high. I would like to know if there is a method or solution for loading only selected nodes from a scene file of cocostudio.
thanks!
I had the same kind of problem, and it stems from trying to make one scene contain everything you need. I decided to split my components into layers, which are then loaded by their own components when needed.
As an example. In my Main Scene I have an inventory tray, a building area and a custom buttons panel. I split all of these into separate layers. InventoryTray.csb, BuildingArea.csb, ButtonPanel.csb and have them all seperate in code as well, one object to load each of the layouts. Overall my code is a lot more maintainable since each class just has a few lines of code in it.
This way I can load my inventory tray up, and not load my buttons panel until the user "needs" to interact with it. The same goes for fancy pause menu's that might include animations and assets that may take up more texture memory. Create it as a separate layer and load it when you need to.
I hope this helps, I never found the cocostudio scenes useful, for anything other than my menu system, since each of the menu scenes that I've built (so far) has been self-contained.
You can try get a component of the .csb:
auto node = CSLoader::createNode("MainScene/MainScene.csb");
node->getComponent("Star_GameButton")->setEnabled(false);
You need the name of your component ,that is on the porperties on cocos Studio
I'm using code blocks with sfml and besides it looking ugly, I'm not sure where to store images. I have to select the exact path by putting it in the project folder in the file system. How do i add images?
Say that your project was in
C:\Users\Me\Documents\MyProj
Then then putting the images in this folder would make them visible to SFML/codeblocks when using only the image name.
If you had an image called image.png then the full path to the image would be
C:\Users\Me\Documents\MyProj\image.png
To get the image into your program you must include
#include <SFML/Graphics.hpp>
And create a texture
sf::Texture Texture1;
And then you can assign this image like
Texture1.loadFromFile("C:\Users\Me\Documents\MyProj\image.png"); //Full path
Texture1.loadFromFile("image.png"); //Relative path
Next you create a sprite
sf::Sprite MySprite
And assign the texture to it
MySprite.setTexture(Texture1);
Finally to draw in the window use
window.draw(MySprite);
I am starter in cocos2d-x.I have multiple sprites of arms legs eyes etc.i want to create a single sprite ,suppose a human out of it who has arms,legs,eyes,head,body etc.How to do it..As i have to animate them and make the human walking and also i have to kill it on touch.Any one here please tell me the logic in cocos2d-x using c++
CocosBuilder can be used for assembling the body parts. By laying down each sprite to its own layer, you can also animate them, create different animations for walking, dying.
Tutorials :
http://www.raywenderlich.com/23996/introduction-to-cocosbuilder
http://www.plungeinteractive.com/blog/2012/10/29/using-cocosbuilder-on-cocos2d-x-games/
There is another way of using it.We can use cocostudio also and export the file as JSON
Refer to this link
http://upyun.cocimg.com/CocoStudio/helpdoc/v1.0.0.0/en/index.html
I know it's possible to create texture by Smart Sprite feature in CocosBuilder 3.0. But it's very unstable now. So I decided to use TexturePacker to generate the texture. My .plist and .png files are generated into different folders for different resolution inside my CocosBuilder project folder like this:
The problem is only the .png files shown in CocosBuilder (I can't find the .plist file):
Of course if I move the .png and .plist file into Resources folder. Both are will be shown inside CocosBuilder. But I have no way to select correct image for different resolution any more. I don't know what wrong with it. Any idea?
Thank you so much.
I sovled the problem. Actually it's because the folder structure. The CocosBuilder doesn't recognize resources-iphone folder. So I rearranged the folder structure like this. Then everything is fine.