Comments (9)
Hmm, that's quite strange. Line 145 in camera.script is just this:
self.data.lpos = go.get_position()
What dependency link do you have in your game.project?
Did you modify any of the rendercam files at all?
from rendercam.
I did not modify anything until this error first appeared. Since it has appeared I have tried debugging with print statements such as print(go.get_position()), print(self.data.lpos) the second print statement actually caused an error once! I checked and that line you gave is the same in my code, unaltered.
from rendercam.
Does it somehow think that self.data is a vector instead of a container? That would explain why it says vmath.vector4 only has fields x, y, z, w. However, it outputs a table in hexadecimal when I put it in a print function. I have tried debugging with
function on_message(self, message_id, message, sender)
if message_id == hash("post-update") then
-- have to update pos after update or it jitters like crazy
print(self.data)
print(self.data.lpos)
print("my pos is ", go.get_position())
-- Update transform stuff
self.data.lpos = go.get_position()
But the go.get_position() statement is not printed
from rendercam.
Very very strange. I'm sorry you're having this problem, I've never heard of anything like this before. Is it possible for you to zip up your project and send it to me? Either attach it here, or send me a message with it on the forum?
Does it somehow think that self.data is a vector instead of a container?
Yes, that's what it sounds like. You should only get that error when trying to set a specific key on a vector4. Maybe it's getting overwritten somewhere by mistake...oh, but you already verified that it's a table, right? Hmm. This is the first error you get in the console, right? There aren't any others before?
from rendercam.
Zipped.zip
Here is the file I have tried to zip.
from rendercam.
While you're here, what do you think is the best way to learn a programming language?
from rendercam.
OK, thanks a lot for the project.
The first thing I tried was removing your player.script from the scene. That solved the problem, there were no errors after that.
The problem was in your init function, this line:
go = vmath.vector4(0, 0, 0, 0)
You're defining a global variable, 'go' as a vector4.
Defold uses 'go' as the namespace (or module name) for all the game object functions. Like go.get_position(), go.set_position(), etc. So when you set 'go' as a global variable, you overwrite all those functions! :D
You should be very careful about setting global variables. Always use local
when you initialize a variable name (including your functions!).
from rendercam.
As for learning a programming language, hmm...haha, that's a big question.
First of all, most programming languages are mostly the same. They may each use slightly different symbols for things, but in general they are very similar. They all have variables, types, functions, "scope", etc. So it's really about learning "programming", not learning one language in particular.
Anyway, for learning I think it's best to alternate between very "boring" studying (reading books and following basic exercises), and more "fun" experimenting on your own.
- Too much "boring" studying, and you will lose interest.
- Too much "fun" experimenting and you will never learn anything properly.
For the "boring" part:
Defold's lua manual is a very good overview to start with: https://defold.com/manuals/lua/
After that, start going through Programming in Lua, chapter by chapter: http://www.lua.org/pil/contents.html (and type in and run all the code yourself.)
For the "fun" part:
Play around with Defold! Keep it small. Try lots of different little tiny things so you get experience. Don't just copy-paste one piece of code that works, or you won't learn anything. Try re-creating the Defold examples yourself: https://defold.com/examples/basics/simple_move/ Maybe try making a small program that could be useful in real life, like a calculator or alarm clock or something. Just for fun. Try to make as many different things as you can, not just one big "perfect dream game".
from rendercam.
When I first started programming, I just copied the code I saw. Since then I have stopped that. I have already started going through the Lua tutorial. I think one point which has helped me a lot so far is that I once read a book on programming logic and design. Thanks for the help!
from rendercam.
Related Issues (20)
- Follow Lerp is bogus - not framerate-independent HOT 1
- No function to transform screen to world coordinates when using Fixed Area/Width/Height mode HOT 3
- Make zoom functions more intuitive, allow animating zoom?
- A way to move camera and shake at the same time? HOT 5
- Need more releases HOT 4
- Initialisation order HOT 3
- Allow fixed aspect ratio -without- black bars.
- Bind "enable" and "disable" messages in camera script. HOT 1
- render.draw_debug2d is deprecated and will be removed in future versions, please use render.draw_debug3d instead. HOT 2
- Render target / render tag components HOT 3
- Screen setup on mobile HOT 3
- rendercam.follow but for only one x,y,z at a time
- Problem with pick node with arbitrary gui position HOT 7
- Multiple camera / settings rendering HOT 2
- FOV modification at runtime HOT 1
- Add easy way to set global constants by tag to be used when rendering predicates
- Screen to world not accurate on same frame as camera movement?
- Zoom to cursor HOT 1
- Frustum culling
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rendercam.